From d9029474077ebd405ec34d44913eed3051f2691e Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Tue, 5 Jan 2016 13:06:22 -0800 Subject: [PATCH] Fix 484941 - NPE AnnotationDiscoveryVisitor --- .../internal/compiler/AjPipeliningCompilerAdapter.java | 6 ++---- tests/bugs188/484941/Test2.java | 10 ++++++++++ .../src/org/aspectj/systemtest/ajc188/Ajc188Tests.java | 4 ++++ tests/src/org/aspectj/systemtest/ajc188/ajc188.xml | 4 ++++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 tests/bugs188/484941/Test2.java diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java index 00f7f8d8c..77410281b 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java @@ -646,10 +646,8 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { return true; // code style } else if (declaration.annotations != null) { // check for annotation style for (int index = 0; index < declaration.annotations.length; index++) { - TypeDeclaration - .resolveAnnotations(declaration.staticInitializerScope, declaration.annotations, declaration.binding); // force - // annotation - // resolution + // Cause annotation resolution + declaration.binding.getAnnotationTagBits(); Annotation a = declaration.annotations[index]; if (a.resolvedType == null) { continue; // another problem is being reported, so don't crash here diff --git a/tests/bugs188/484941/Test2.java b/tests/bugs188/484941/Test2.java new file mode 100644 index 000000000..fd2623575 --- /dev/null +++ b/tests/bugs188/484941/Test2.java @@ -0,0 +1,10 @@ + +@ContextConfiguration +public class Test2 { + static class ContextConfiguration { + + } +} + +@interface ContextConfiguration { +} diff --git a/tests/src/org/aspectj/systemtest/ajc188/Ajc188Tests.java b/tests/src/org/aspectj/systemtest/ajc188/Ajc188Tests.java index c2a994855..1a5f5a465 100644 --- a/tests/src/org/aspectj/systemtest/ajc188/Ajc188Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc188/Ajc188Tests.java @@ -21,6 +21,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc188Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testAnnotationDiscoveryNpe() throws Exception { + runTest("annotation discovery npe"); + } + public void testDefaultMethodsWithXnoInline() throws Exception { runTest("default methods 1"); } diff --git a/tests/src/org/aspectj/systemtest/ajc188/ajc188.xml b/tests/src/org/aspectj/systemtest/ajc188/ajc188.xml index 2e8a8b62f..a9844f79f 100644 --- a/tests/src/org/aspectj/systemtest/ajc188/ajc188.xml +++ b/tests/src/org/aspectj/systemtest/ajc188/ajc188.xml @@ -2,6 +2,10 @@ + + + + -- 2.39.5