From: Andy Clement Date: Tue, 5 Jan 2016 21:06:22 +0000 (-0800) Subject: Fix 484941 - NPE AnnotationDiscoveryVisitor X-Git-Tag: V1_8_8~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d9029474077ebd405ec34d44913eed3051f2691e;p=aspectj.git Fix 484941 - NPE AnnotationDiscoveryVisitor --- 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 @@ + + + +