summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-01-14 21:36:18 +0000
committerjhugunin <jhugunin>2003-01-14 21:36:18 +0000
commitc1260e6b26b78f0f431b778cd8f22d3493e97f3f (patch)
treef1fbf20ab75fcf540f71727db8e944fff23bdcb6 /weaver
parentf60b7314484724099896fd9ace6f26e5363b6476 (diff)
downloadaspectj-c1260e6b26b78f0f431b778cd8f22d3493e97f3f.tar.gz
aspectj-c1260e6b26b78f0f431b778cd8f22d3493e97f3f.zip
fixed bug #29186, much better handling of structure generation
added an Xlint flag for warnings when join points don't have structure nodes
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/AsmAdaptor.java15
-rw-r--r--weaver/src/org/aspectj/weaver/Lint.java3
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedTypeX.java4
-rw-r--r--weaver/src/org/aspectj/weaver/Shadow.java2
-rw-r--r--weaver/src/org/aspectj/weaver/XlintDefault.properties4
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java5
6 files changed, 29 insertions, 4 deletions
diff --git a/weaver/src/org/aspectj/weaver/AsmAdaptor.java b/weaver/src/org/aspectj/weaver/AsmAdaptor.java
index 256f7c470..c9c0e52c0 100644
--- a/weaver/src/org/aspectj/weaver/AsmAdaptor.java
+++ b/weaver/src/org/aspectj/weaver/AsmAdaptor.java
@@ -77,6 +77,7 @@ public class AsmAdaptor {
private static ProgramElementNode getNode(StructureModel model, Advice a) {
//ResolvedTypeX inAspect = a.getConcreteAspect();
Member member = a.getSignature();
+ if (a.getSignature() == null) return null;
return lookupMember(model, member);
}
@@ -84,6 +85,13 @@ public class AsmAdaptor {
Member enclosingMember = shadow.getEnclosingCodeSignature();
ProgramElementNode enclosingNode = lookupMember(model, enclosingMember);
+ if (enclosingNode == null) {
+ Lint.Kind err = shadow.getIWorld().getLint().shadowNotInStructure;
+ if (err.isEnabled()) {
+ err.signal(shadow.toString(), shadow.getSourceLocation());
+ }
+ return null;
+ }
Member shadowSig = shadow.getSignature();
if (!shadowSig.equals(enclosingMember)) {
@@ -117,7 +125,7 @@ public class AsmAdaptor {
"",
new ArrayList());
- System.err.println(peNode.getSourceLocation());
+ //System.err.println(peNode.getSourceLocation());
peNode.setBytecodeName(shadowSig.getName());
peNode.setBytecodeSignature(shadowSig.getSignature());
enclosingNode.addChild(peNode);
@@ -142,13 +150,16 @@ public class AsmAdaptor {
if (classNode == null) return null; // XXX remove this check
for (Iterator it = classNode.getChildren().iterator(); it.hasNext(); ) {
ProgramElementNode node = (ProgramElementNode)it.next();
+ //System.err.println("checking: " + member.getName() + " with " + node.getBytecodeName() + ", " + node.getBytecodeSignature());
if (member.getName().equals(node.getBytecodeName()) &&
member.getSignature().equals(node.getBytecodeSignature()))
{
return node;
}
}
- return null;
+ // if we can't find the member, we'll just put it in the class
+ //??? is this what the IDEs want
+ return classNode;
}
diff --git a/weaver/src/org/aspectj/weaver/Lint.java b/weaver/src/org/aspectj/weaver/Lint.java
index eeef10f10..80163d951 100644
--- a/weaver/src/org/aspectj/weaver/Lint.java
+++ b/weaver/src/org/aspectj/weaver/Lint.java
@@ -37,6 +37,9 @@ public class Lint {
public final Kind typeNotExposedToWeaver =
new Kind("typeNotExposedToWeaver", "this affected type is not exposed to the weaver: {0}");
+ public final Kind shadowNotInStructure =
+ new Kind("shadowNotInStructure", "the shadow for this join point is not exposed in the structure model: {0}");
+
public Lint(World world) {
this.world = world;
}
diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
index b22087543..b6b0a4fe3 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
@@ -436,6 +436,10 @@ public abstract class ResolvedTypeX extends TypeX {
}
+ public boolean isSynthetic() {
+ return signature.indexOf("$ajc") != -1;
+ }
+
public final boolean isFinal() {
return Modifier.isFinal(getModifiers());
}
diff --git a/weaver/src/org/aspectj/weaver/Shadow.java b/weaver/src/org/aspectj/weaver/Shadow.java
index 505006ccc..fe58a5672 100644
--- a/weaver/src/org/aspectj/weaver/Shadow.java
+++ b/weaver/src/org/aspectj/weaver/Shadow.java
@@ -305,7 +305,7 @@ public abstract class Shadow {
ShadowMunger munger = (ShadowMunger) iter.next();
munger.implementOn(this);
if (world.getModel() != null) {
- System.err.println("munger: " + munger + " on " + this);
+ //System.err.println("munger: " + munger + " on " + this);
AsmAdaptor.noteMunger(world.getModel(), this, munger);
}
}
diff --git a/weaver/src/org/aspectj/weaver/XlintDefault.properties b/weaver/src/org/aspectj/weaver/XlintDefault.properties
index 25e48c76e..59d6d2f28 100644
--- a/weaver/src/org/aspectj/weaver/XlintDefault.properties
+++ b/weaver/src/org/aspectj/weaver/XlintDefault.properties
@@ -3,4 +3,6 @@ invalidWildcardTypeName = ignore
unresolvableMember = warning
-typeNotExposedToWeaver = warning \ No newline at end of file
+typeNotExposedToWeaver = warning
+
+shadowNotInStructure = ignore \ No newline at end of file
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index 1d62b92cb..53ccfd705 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -294,6 +294,11 @@ public class BcelWeaver implements IWeaver {
// non-private for testing
LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType) throws IOException {
+ if (classType.isSynthetic()) {
+ dumpUnchanged(classFile);
+ return null;
+ }
+
JavaClass javaClass = classType.getJavaClass();
List shadowMungers = fastMatch(shadowMungerList, javaClass);
List typeMungers = fastMatch(classType.getInterTypeMungers(), javaClass);