null, null);
}
public void processReweavableStateIfPresent(String className, BcelObjectType classType) {
// If the class is marked reweavable, check any aspects around when it was built are in this world
WeaverStateInfo wsi = classType.getWeaverState();
if (wsi!=null && wsi.isReweavable()) { // Check all necessary types are around!
world.showMessage(IMessage.INFO,
WeaverMessages.format(WeaverMessages.PROCESSING_REWEAVABLE,className,classType.getSourceLocation().getSourceFile()),
null,null);
Set aspectsPreviouslyInWorld = wsi.getAspectsAffectingType();
if (aspectsPreviouslyInWorld!=null) {
// keep track of them just to ensure unique missing aspect error reporting
Set alreadyConfirmedReweavableState = new HashSet();
for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) {
String requiredTypeName = (String) iter.next();
if (!alreadyConfirmedReweavableState.contains(requiredTypeName)) {
ResolvedType rtx = world.resolve(UnresolvedType.forName(requiredTypeName),true);
boolean exists = !rtx.isMissing();
if (!exists) {
world.showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.MISSING_REWEAVABLE_TYPE,requiredTypeName,className),
classType.getSourceLocation(), null);
} else {
// weaved in aspect that are not declared in aop.xml trigger an error for now
// may cause headhache for LTW and packaged lib without aop.xml in
// see #104218
if(!xcutSet.containsAspect(rtx)){
world.showMessage(
IMessage.ERROR,
WeaverMessages.format(
WeaverMessages.REWEAVABLE_ASPECT_NOT_REGISTERED,
requiredTypeName,
className
),
null,
null
);
} else if (!world.getMessageHandler().isIgnoring(IMessage.INFO))
world.showMessage(IMessage.INFO,
WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE,requiredTypeName,rtx.getSourceLocation().getSourceFile()),
null,null);
alreadyConfirmedReweavableState.add(requiredTypeName);
}
}
}
}
// old:
//classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass().getFileName(), wsi.getUnwovenClassFileData()));
// new: reweavable default with clever diff
classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass().getFileName(), wsi.getUnwovenClassFileData(classType.getJavaClass().getBytes())));
} else {
classType.resetState();
}
}