diff options
-rw-r--r-- | tests/ajcTests.xml | 4 | ||||
-rw-r--r-- | tests/mikTests.xml | 14 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/AsmAdapter.java (renamed from weaver/src/org/aspectj/weaver/AsmAdaptor.java) | 118 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/Checker.java | 3 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/Shadow.java | 2 |
5 files changed, 52 insertions, 89 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 5fa1ab82d..1412ad04d 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6250,7 +6250,9 @@ <ajc-test dir="bugs/lines" pr="37758" title="Weaving rt.jar results in stack overflow"> - <compile files="A.java,big.jar"/> + <compile files="A.java,big.jar"> + <message kind="warning" text="manifest not copied"/> + </compile> <run class="Big"/> </ajc-test> diff --git a/tests/mikTests.xml b/tests/mikTests.xml index 111011c01..ead6fe7a8 100644 --- a/tests/mikTests.xml +++ b/tests/mikTests.xml @@ -2,9 +2,11 @@ <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"> <suite> - <ajc-test dir="bugs/bootstrapClasspath" pr="39959" - title="AJC Compiler generates invalid class files under certain circumstances."> - <compile files="UsesDOMParser.java" classpath="xerces.jar" /> - <run class="UsesDOMParser"/> - </ajc-test> -</suite>
\ No newline at end of file + <ajc-test dir="bugs/lines" pr="37758" + title="Weaving rt.jar results in stack overflow"> + <compile files="A.java,big.jar"> + <message kind="warning" text="manifest not copied"/> + </compile> + <run class="Big"/> + </ajc-test> +</suite>
\ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/AsmAdaptor.java b/weaver/src/org/aspectj/weaver/AsmAdapter.java index e448896a4..a0dc847ff 100644 --- a/weaver/src/org/aspectj/weaver/AsmAdaptor.java +++ b/weaver/src/org/aspectj/weaver/AsmAdapter.java @@ -19,93 +19,55 @@ import org.aspectj.asm.*; import org.aspectj.asm.internal.*; import org.aspectj.bridge.*; -public class AsmAdaptor { +public class AsmAdapter { + + public static final String ADVISES = "advises"; + public static final String ADVISED_BY = "advised by"; + public static final String DECLARES_ON = "declares on"; + public static final String DECLAREDY_BY = "declared by"; + + public static void checkerMunger(StructureModel model, Shadow shadow) { +// System.err.println("> " + shadow.getThisVar() + " to " + shadow.getTargetVar()); + } public static void nodeMunger(StructureModel model, Shadow shadow, ShadowMunger munger) { if (munger instanceof Advice) { Advice a = (Advice)munger; -// if (a.getKind().isPerEntry() || a.getKind().isCflow()) { - // ??? might want to show these in the future -// return; -// } + if (a.getKind().isPerEntry() || a.getKind().isCflow()) { + // TODO: might want to show these in the future + return; + } + IRelationshipMapper mapper = StructureModelManager.getDefault().getMapper(); -// System.out.println("--------------------------"); IProgramElement targetNode = getNode(model, shadow); IProgramElement adviceNode = getNode(model, a); if (adviceNode != null && targetNode != null) { -// mapper.putRelationshipForElement( -// adviceNode, -// ADVICE, -// targetNode); - } - -// System.out.println("> target: " + targetNode + ", advice: " + adviceNode); -// throw new RuntimeException("unimplemented"); -// IRelationship relation = new Relationship(); -// if (shadow.getKind().equals(Shadow.FieldGet) || shadow.getKind().equals(Shadow.FieldSet)) { -// relation = AdviceAssociation.FIELD_ACCESS_RELATION; -// } else if (shadow.getKind().equals(Shadow.Initialization) || shadow.getKind().equals(Shadow.StaticInitialization)) { -// relation = AdviceAssociation.INITIALIZER_RELATION; -// } else if (shadow.getKind().equals(Shadow.ExceptionHandler)) { -// relation = AdviceAssociation.HANDLER_RELATION; -// } else if (shadow.getKind().equals(Shadow.MethodCall)) { -// relation = AdviceAssociation.METHOD_CALL_SITE_RELATION; -// } else if (shadow.getKind().equals(Shadow.ConstructorCall)) { -// relation = AdviceAssociation.CONSTRUCTOR_CALL_SITE_RELATION; -// } else if (shadow.getKind().equals(Shadow.MethodExecution) || shadow.getKind().equals(Shadow.AdviceExecution)) { -// relation = AdviceAssociation.METHOD_RELATION; -// } else if (shadow.getKind().equals(Shadow.ConstructorExecution)) { -// relation = AdviceAssociation.CONSTRUCTOR_RELATION; -// } else if (shadow.getKind().equals(Shadow.PreInitialization)) { -// // TODO: someone should check that this behaves reasonably in the IDEs -// relation = AdviceAssociation.INITIALIZER_RELATION; -// } else { -// System.err.println("> unmatched relation: " + shadow.getKind()); -// relation = AdviceAssociation.METHOD_RELATION; -// } -// createAppropriateLinks(targetNode, adviceNode, relation); - } - } - - private static void createAppropriateLinks( - IProgramElement target, - IProgramElement advice, - IRelationship relation) - { - if (target == null || advice == null) return; - - -// addLink(target, new LinkNode(advice), relation, true); -// addLink(advice, new LinkNode(target), relation, false); - } + IRelationship foreward = mapper.get(adviceNode); + if (foreward == null) { + foreward = new Relationship( + ADVISES, + IRelationship.Kind.ADVICE, + adviceNode, + new ArrayList() + ); + mapper.put(adviceNode, foreward); + } + foreward.getTargets().add(targetNode); - private static void addLink( - IProgramElement onNode, -// LinkNode linkNode, - IRelationship relation, - boolean isBack) - { - IRelationship node = null; - String relationName = relation.getName(); -// isBack ? relation() : relation.getForwardNavigationName(); - - //System.err.println("on: " + onNode + " relationName: " + relationName + " existin: " + onNode.getRelations()); - - for (Iterator i = onNode.getRelations().iterator(); i.hasNext();) { - IRelationship relationNode = (IRelationship) i.next(); - if (relationName.equals(relationNode.getName())) { - node = relationNode; - break; + IRelationship back = mapper.get(targetNode); + if (back == null) { + back = new Relationship( + ADVISED_BY, + IRelationship.Kind.ADVICE, + targetNode, + new ArrayList() + ); + mapper.put(targetNode, back); + } + back.getTargets().add(adviceNode); } - } - if (node == null) { - throw new RuntimeException("unimplemented"); -// node = new Relationship(relation, relationName, new ArrayList()); -// onNode.getRelations().add(node); } -// node.getTargets().add(linkNode); - } private static IProgramElement getNode(StructureModel model, Advice a) { @@ -167,15 +129,11 @@ public class AsmAdaptor { enclosingNode.addChild(peNode); return peNode; } - - - - public static IProgramElement lookupMember(StructureModel model, Member member) { TypeX declaringType = member.getDeclaringType(); IProgramElement classNode = - model.findNodeForClass(declaringType.getPackageName(), declaringType.getClassName()); + model.findNodeForType(declaringType.getPackageName(), declaringType.getClassName()); return findMemberInClass(classNode, member); } diff --git a/weaver/src/org/aspectj/weaver/Checker.java b/weaver/src/org/aspectj/weaver/Checker.java index 4e4517077..83c9f40b9 100644 --- a/weaver/src/org/aspectj/weaver/Checker.java +++ b/weaver/src/org/aspectj/weaver/Checker.java @@ -54,7 +54,8 @@ public class Checker extends ShadowMunger { isError ? IMessage.ERROR : IMessage.WARNING, shadow.getSourceLocation()); world.getMessageHandler().handleMessage(message); - + + AsmAdapter.checkerMunger(world.getModel(), shadow); } return false; } diff --git a/weaver/src/org/aspectj/weaver/Shadow.java b/weaver/src/org/aspectj/weaver/Shadow.java index ade726ba9..a6ec5529a 100644 --- a/weaver/src/org/aspectj/weaver/Shadow.java +++ b/weaver/src/org/aspectj/weaver/Shadow.java @@ -341,7 +341,7 @@ public abstract class Shadow { munger.implementOn(this); if (world.getModel() != null) { //System.err.println("munger: " + munger + " on " + this); - AsmAdaptor.nodeMunger(world.getModel(), this, munger); + AsmAdapter.nodeMunger(world.getModel(), this, munger); } } } |