From d4219e12eaa86ed810392364931a92324dc2a67f Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 16 Feb 2006 09:33:38 +0000 Subject: [PATCH] test and fix for 121616 --- .../ast/ValidateAtAspectJAnnotationsVisitor.java | 3 +++ tests/bugs151/pr121616.java | 16 ++++++++++++++++ .../aspectj/systemtest/ajc151/Ajc151Tests.java | 4 ++++ .../src/org/aspectj/systemtest/ajc151/ajc151.xml | 6 ++++++ 4 files changed, 29 insertions(+) create mode 100644 tests/bugs151/pr121616.java diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java index e16e73d51..313411f7b 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java @@ -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 index 000000000..656260112 --- /dev/null +++ b/tests/bugs151/pr121616.java @@ -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); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java index 7a64444b9..24b006fd2 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -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 */ diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml index de0488dbd..46e8bc97d 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml @@ -176,6 +176,12 @@ + + + + + + -- 2.39.5