From: aclement Date: Wed, 20 Apr 2005 14:32:40 +0000 (+0000) Subject: Fix for pr92053: atargs causes a VerifyError: Unable to pop operand off an empty... X-Git-Tag: PRE_ANDY~459 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f942a4c58210535e91c50a037a8d743a0c70e19;p=aspectj.git Fix for pr92053: atargs causes a VerifyError: Unable to pop operand off an empty stack --- diff --git a/tests/java5/annotations/binding/bugs/Test3.java b/tests/java5/annotations/binding/bugs/Test3.java new file mode 100644 index 000000000..93b3ebf86 --- /dev/null +++ b/tests/java5/annotations/binding/bugs/Test3.java @@ -0,0 +1,23 @@ +import java.lang.annotation.*; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@interface Ann {} + +@Ann +class C{} + +public class Test3 { + + public static void main(String[] args) { + C a = new C(); + abc(a); + } + + static void abc(C y) {} +} + + +aspect Annotations { + before(Ann ann) : call(* Test3.*(..)) && @args(ann) { } +} diff --git a/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java b/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java index 14cfbc008..ab7940e73 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java +++ b/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java @@ -393,5 +393,9 @@ public class AnnotationBinding extends XMLBasedAjcTestCase { assertTrue("Should point to line 10 but doesnt: "+tgt,tgt.indexOf("|10|")!=-1); } } + + public void testAnnotationBindingArgsVerifyError_pr92053() { + runTest("AtArgs causes a VerifyError: Unable to pop operand off an empty stack"); + } } \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index b2005b972..8001d474a 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -2149,5 +2149,10 @@ + + + + + \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java index dfb97e743..ce9125476 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java @@ -137,24 +137,18 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut { WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_ARG_TYPE,argType.getName()), "",IMessage.ERROR,shadow.getSourceLocation(),null,new ISourceLocation[]{getSourceLocation()}); } - if (ap.matches(rArgType).alwaysTrue()) { // !!! ASC Can we ever take this branch? - // !!! AMC - Yes, if annotation is @Inherited - argsIndex++; - continue; - } else { + + ResolvedTypeX rAnnType = ap.annotationType.resolve(shadow.getIWorld()); + if (ap instanceof BindingAnnotationTypePattern) { + BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern)ap; + Var annvar = shadow.getArgAnnotationVar(argsIndex,rAnnType); + state.set(btp.getFormalIndex(),annvar); + } + if (!ap.matches(rArgType).alwaysTrue()) { // we need a test... - ResolvedTypeX rAnnType = ap.annotationType.resolve(shadow.getIWorld()); - if (ap instanceof BindingAnnotationTypePattern) { - BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern)ap; - Var annvar = shadow.getArgAnnotationVar(argsIndex,rAnnType); - state.set(btp.getFormalIndex(),annvar); - ret = Test.makeAnd(ret,Test.makeHasAnnotation(shadow.getArgVar(argsIndex),rAnnType)); - argsIndex++; - } else { - ret = Test.makeAnd(ret,Test.makeHasAnnotation(shadow.getArgVar(argsIndex),rAnnType)); - argsIndex++; - } - } + ret = Test.makeAnd(ret,Test.makeHasAnnotation(shadow.getArgVar(argsIndex),rAnnType)); + } + argsIndex++; } } return ret;