From d16403655828b58d1ffbdb8d9ab4457c097bd746 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 5 Jul 2006 12:48:36 +0000 Subject: [PATCH] pr145693 - fix for part 1 --- .../systemtest/ajc153/Ajc153Tests.java | 6 ++++- .../org/aspectj/systemtest/ajc153/ajc153.xml | 26 +++++++++++++++++++ .../patterns/ConcreteCflowPointcut.java | 21 +++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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; } -- 2.39.5