]> source.dussan.org Git - aspectj.git/commitdiff
Fix for pr92053: atargs causes a VerifyError: Unable to pop operand off an empty...
authoraclement <aclement>
Wed, 20 Apr 2005 14:32:40 +0000 (14:32 +0000)
committeraclement <aclement>
Wed, 20 Apr 2005 14:32:40 +0000 (14:32 +0000)
tests/java5/annotations/binding/bugs/Test3.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java

diff --git a/tests/java5/annotations/binding/bugs/Test3.java b/tests/java5/annotations/binding/bugs/Test3.java
new file mode 100644 (file)
index 0000000..93b3ebf
--- /dev/null
@@ -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) { }
+}
index 14cfbc0088ae6f876ea02cd76ab0237862578363..ab7940e73238da6b0027bdc93f4ebf4f9cc22969 100644 (file)
@@ -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
index b2005b97208716bd75ec3a370afc47b779d13212..8001d474a7d4c1efa83f3cd975f9f1409156184f 100644 (file)
         <compile files="ITDReturningParameterizedType.aj" options="-1.5"/>
         <run class="ITDReturningParameterizedType"/>
     </ajc-test>
+    
+    <ajc-test dir="java5/annotations/binding/bugs" title="AtArgs causes a VerifyError: Unable to pop operand off an empty stack" vm="1.5">
+        <compile files="Test3.java" options="-1.5"/>
+        <run class="Test3"/>
+    </ajc-test>
  
 </suite>
\ No newline at end of file
index dfb97e743137b0dc3d903477eb45eb2f5524c08d..ce9125476b0e477997199ba8f45d39c2e692c5cb 100644 (file)
@@ -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;