]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 121616
authoraclement <aclement>
Thu, 16 Feb 2006 09:33:38 +0000 (09:33 +0000)
committeraclement <aclement>
Thu, 16 Feb 2006 09:33:38 +0000 (09:33 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
tests/bugs151/pr121616.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml

index e16e73d517fc04d24c719ca1ca40b34a7b1cb56a..313411f7ba742e5cae9c2acc5d616e2549141500 100644 (file)
@@ -147,6 +147,9 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
        }
        
        public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
+               if (methodDeclaration.hasErrors()) {
+                       return false;
+               }
                ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.VALIDATING_AT_ASPECTJ_ANNOTATIONS, methodDeclaration.selector);
                ajAnnotations = new AspectJAnnotations(methodDeclaration.annotations);
                if (!methodDeclaration.getClass().equals(AjMethodDeclaration.class)) {
diff --git a/tests/bugs151/pr121616.java b/tests/bugs151/pr121616.java
new file mode 100644 (file)
index 0000000..6562601
--- /dev/null
@@ -0,0 +1,16 @@
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+class Main {
+        public static void main(String[] args) {
+                System.out.println("Main");
+        }
+}
+
+@Aspect
+class MainLogger {
+    @Before("execution(* main(..))")
+    public void log(JoinPoint thisJoinPoint) {
+            System.out.println("Before " + thisJoinPoint);
+    }
+}
index 7a64444b9128bdb416a835f4246ee2b6c342eba6..24b006fd2831cf7cc7e455ddf504aebea27a07c2 100644 (file)
@@ -160,6 +160,10 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("@AJ no NPE with deow when structure model isn't generated"); 
   }
   
+  public void testAtAspectWithoutJoinPointImport_pr121616() {
+         runTest("@AJ without JoinPoint import");
+  }
+  
   /*
    * Load-time weaving bugs and enhancements
    */
index de0488dbd2b2eef31da7fcb84f1afbd73cbba345..46e8bc97ddcd0049b95862bcbbf69b5baa64dc24 100644 (file)
         </compile>
     </ajc-test>
 
+    <ajc-test dir="bugs151" title="@AJ without JoinPoint import">
+        <compile files="pr121616.java" options="-1.5">
+          <message kind="error" line="13" text="JoinPoint cannot be resolved to a type"/>
+        </compile>
+    </ajc-test>
+
     <!-- New features down here... when they arent big enough to have their own test file -->
     
     <ajc-test dir="features151/ptw" title="exposing withintype">