diff options
3 files changed, 52 insertions, 1 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java index 8e09602c4..18b1f86e0 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -29,7 +29,10 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("verification problem"); // build the code Utils.verifyClass(ajc,"mypackage.MyAspect"); // verify it <<< BRAND NEW VERIFY UTILITY FOR EVERYONE TO TRY ;) } - public void testIncorrectAnnotationValue_pr148537() { runTest("incorrect annotation value");} + public void testIncorrectAnnotationValue_pr148537() { runTest("incorrect annotation value");} + public void testVerifyErrNoTypeCflowField_pr145693_1() { runTest("verifyErrNoTypeCflowField"); } +// public void testVerifyErrInpathNoTypeCflowField_pr145693_2() { runTest("verifyErrInpathNoTypeCflowField"); } +// public void testCpathNoTypeCflowField_pr145693_3() { runTest("cpathNoTypeCflowField"); } ///////////////////////////////////////// @@ -40,5 +43,6 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { protected File getSpecFile() { return new File("../tests/src/org/aspectj/systemtest/ajc153/ajc153.xml"); } + }
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index 4bc76dd65..6024e6557 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -48,5 +48,31 @@ </compile> </ajc-test> + <ajc-test dir="bugs153/pr145693" title="verifyErrNoTypeCflowField"> + <compile files="Event.java" outjar="cpath.jar"/> + <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar"/> + <compile files="Sample.java" options="-Xlint:ignore" aspectpath="apath.jar" outjar="run.jar"> + <message kind="warning" line="8" text="Unable to determine match at this join point because the type 'Event' cannot be found"/> + </compile> + <run class="Sample" classpath="run.jar,apath.jar"> + <stderr> + <line text="method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr145693" title="verifyErrInpathNoTypeCflowField"> + <compile files="Event.java" outjar="cpath.jar"/> + <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar"/> + <compile files="Sample.java" options="-Xlint:ignore" inpath="cpath.jar" aspectpath="apath.jar" outjar="run.jar"/> + <run class="Sample" classpath="run.jar,apath.jar"/> + </ajc-test> + + <ajc-test dir="bugs153/pr145693" title="cpathNoTypeCflowField"> + <compile files="Event.java" outjar="cpath.jar"/> + <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar"/> + <compile files="Sample.java" options="-Xlint:ignore" classpath="cpath.jar" aspectpath="apath.jar" outjar="run.jar"/> + <run class="Sample" classpath="run.jar,apath.jar"/> + </ajc-test> </suite>
\ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java index 01f4c3888..1053dbe82 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java @@ -19,6 +19,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.aspectj.bridge.ISourceLocation; +import org.aspectj.bridge.Message; import org.aspectj.util.FuzzyBoolean; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.Member; @@ -27,6 +29,7 @@ import org.aspectj.weaver.NameMangler; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.UnresolvedType; +import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.ast.Expr; import org.aspectj.weaver.ast.Test; import org.aspectj.weaver.bcel.BcelCflowAccessVar; @@ -55,6 +58,24 @@ public class ConcreteCflowPointcut extends Pointcut { protected FuzzyBoolean matchInternal(Shadow shadow) { //??? this is not maximally efficient + // Check we'll be able to do the residue! + + // this bit is for pr145693 - we cannot match at all if one of the types is missing, we will be unable + // to create the residue + if (slots != null) { + for (Iterator i = slots.iterator(); i.hasNext();) { + Slot slot = (Slot) i.next(); + ResolvedType rt = slot.formalType; + if (rt.isMissing()) { + ISourceLocation[] locs = new ISourceLocation[]{getSourceLocation()}; + Message m = new Message( + WeaverMessages.format(WeaverMessages.MISSING_TYPE_PREVENTS_MATCH,rt.getName()), + "",Message.WARNING,shadow.getSourceLocation(),null,locs); + rt.getWorld().getMessageHandler().handleMessage(m); + return FuzzyBoolean.NO; + } + } + } return FuzzyBoolean.MAYBE; } |