import java.util.Map;
import java.util.Set;
import java.util.jar.Attributes;
+import java.util.jar.Attributes.Name;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
-import java.util.jar.Attributes.Name;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
* @param userPointcut
*/
private void raiseUnboundFormalError(String name, Pointcut userPointcut) {
- world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.UNBOUND_FORMAL, name), userPointcut
- .getSourceLocation(), null);
+ world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.UNBOUND_FORMAL, name),
+ userPointcut.getSourceLocation(), null);
}
public void addManifest(Manifest newManifest) {
ResolvedType rtx = world.resolve(UnresolvedType.forSignature(requiredTypeSignature), true);
boolean exists = !rtx.isMissing();
if (!exists) {
- world.getLint().missingAspectForReweaving.signal(new String[] { rtx.getName(), className }, classType
- .getSourceLocation(), null);
+ world.getLint().missingAspectForReweaving.signal(new String[] { rtx.getName(), className },
+ classType.getSourceLocation(), null);
// world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.MISSING_REWEAVABLE_TYPE,
// requiredTypeName, className), classType.getSourceLocation(), null);
} else {
world.showMessage(IMessage.ERROR, WeaverMessages.format(
WeaverMessages.REWEAVABLE_ASPECT_NOT_REGISTERED, rtx.getName(), className), null, null);
} else if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) {
- world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE, rtx
- .getName(), rtx.getSourceLocation().getSourceFile()), null, null);
+ world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE,
+ rtx.getName(), rtx.getSourceLocation().getSourceFile()), null, null);
}
}
alreadyConfirmedReweavableState.add(requiredTypeSignature);
// TAG: WeavingMessage
if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
getWorld().getMessageHandler().handleMessage(
- WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] {
- onType.toString(), Utility.beautifyLocation(onType.getSourceLocation()),
- decA.getAnnotationString(), "type", decA.getAspect().toString(),
- Utility.beautifyLocation(decA.getSourceLocation()) }));
+ WeaveMessage.constructWeavingMessage(
+ WeaveMessage.WEAVEMESSAGE_ANNOTATES,
+ new String[] { onType.toString(), Utility.beautifyLocation(onType.getSourceLocation()),
+ decA.getAnnotationString(), "type", decA.getAspect().toString(),
+ Utility.beautifyLocation(decA.getSourceLocation()) }));
}
didSomething = true;
ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX);
if (outputProblems) {
if (decA.isExactPattern()) {
world.getMessageHandler().handleMessage(
- MessageUtil.error(WeaverMessages.format(WeaverMessages.INCORRECT_TARGET_FOR_DECLARE_ANNOTATION,
- onType.getName(), annoX.getTypeName(), annoX.getValidTargets()), decA.getSourceLocation()));
+ MessageUtil.error(
+ WeaverMessages.format(WeaverMessages.INCORRECT_TARGET_FOR_DECLARE_ANNOTATION,
+ onType.getName(), annoX.getTypeName(), annoX.getValidTargets()),
+ decA.getSourceLocation()));
} else {
if (world.getLint().invalidTargetForAnnotation.isEnabled()) {
world.getLint().invalidTargetForAnnotation.signal(new String[] { onType.getName(), annoX.getTypeName(),
- annoX.getValidTargets() }, decA.getSourceLocation(), new ISourceLocation[] { onType
- .getSourceLocation() });
+ annoX.getValidTargets() }, decA.getSourceLocation(),
+ new ISourceLocation[] { onType.getSourceLocation() });
}
}
}
}
public void weaveNormalTypeMungers(ResolvedType onType) {
- ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_TYPE_MUNGERS, onType
- .getName());
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_TYPE_MUNGERS,
+ onType.getName());
if (onType.isRawType() || onType.isParameterizedType()) {
onType = onType.getGenericType();
}
String pkgname = classType.getResolvedTypeX().getPackageName();
String tname = classType.getResolvedTypeX().getSimpleBaseName();
IProgramElement typeElement = hierarchy.findElementForType(pkgname, tname);
- if (typeElement != null && !hasInnerAspect(typeElement)) {
+ if (typeElement != null && !hasInnerType(typeElement)) {
// Set<String> deleted = new HashSet<String>();
// deleted.add(model.getCanonicalFilePath(typeElement.getSourceLocation().getSourceFile()));
// ---- writing
- private boolean hasInnerAspect(IProgramElement typeNode) {
+ // TODO could be smarter - really only matters if inner type has been woven, but there is a chance we haven't woven it *yet*
+ private boolean hasInnerType(IProgramElement typeNode) {
for (IProgramElement child : typeNode.getChildren()) {
IProgramElement.Kind kind = child.getKind();
- if (kind == IProgramElement.Kind.ASPECT) {
+ if (kind.isType()) {
return true;
}
- if (kind.isType()) {
- boolean b = hasInnerAspect(child);
+ // if (kind == IProgramElement.Kind.ASPECT) {
+ // return true;
+ // }
+ if (kind.isType() || kind == IProgramElement.Kind.METHOD || kind == IProgramElement.Kind.CONSTRUCTOR) {
+ boolean b = hasInnerType(child);
if (b) {
return b;
}