summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2010-08-05 16:49:45 +0000
committeraclement <aclement>2010-08-05 16:49:45 +0000
commitdb423fea1bfc5f7a3fcda442fcad64a442c0eff0 (patch)
tree525c5b2b4765dfedc0f8d543e3f5bd55a21ea7d3
parent47b1728bdce19ddb5339aa492464765cc1bb4982 (diff)
downloadaspectj-db423fea1bfc5f7a3fcda442fcad64a442c0eff0.tar.gz
aspectj-db423fea1bfc5f7a3fcda442fcad64a442c0eff0.zip
278496: anon inner types affected by aspects
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java51
1 files changed, 29 insertions, 22 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index d71d5b367..f812e81f2 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -28,10 +28,10 @@ import java.util.List;
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;
@@ -932,8 +932,8 @@ public class BcelWeaver {
* @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) {
@@ -1335,8 +1335,8 @@ public class BcelWeaver {
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 {
@@ -1353,8 +1353,8 @@ public class BcelWeaver {
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);
@@ -1528,10 +1528,11 @@ public class BcelWeaver {
// 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);
@@ -1554,13 +1555,15 @@ public class BcelWeaver {
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() });
}
}
}
@@ -1601,8 +1604,8 @@ public class BcelWeaver {
}
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();
}
@@ -1721,7 +1724,7 @@ public class BcelWeaver {
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()));
@@ -1782,14 +1785,18 @@ public class BcelWeaver {
// ---- 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;
}