]> source.dussan.org Git - aspectj.git/commitdiff
Fix 484941 - NPE AnnotationDiscoveryVisitor
authorAndy Clement <aclement@pivotal.io>
Tue, 5 Jan 2016 21:06:22 +0000 (13:06 -0800)
committerAndy Clement <aclement@pivotal.io>
Tue, 5 Jan 2016 21:06:22 +0000 (13:06 -0800)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java
tests/bugs188/484941/Test2.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc188/Ajc188Tests.java
tests/src/org/aspectj/systemtest/ajc188/ajc188.xml

index 00f7f8d8c7da1e3edc42c3d3d9da04d425f3b4a3..77410281b890e517511d4d51be6f1791393bfbe2 100644 (file)
@@ -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 (file)
index 0000000..fd26235
--- /dev/null
@@ -0,0 +1,10 @@
+\r
+@ContextConfiguration\r
+public class Test2 {\r
+    static class ContextConfiguration {\r
+\r
+    }\r
+}\r
+\r
+@interface ContextConfiguration {\r
+}\r
index c2a994855f2cb8d4cbb6909abac5410c41358dc2..1a5f5a4656da8cc7d19bec09d46e60164e09489e 100644 (file)
@@ -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");
        }
index 2e8a8b62f8e62dce2ba00876cf46e6fe50f13815..a9844f79f07797b8fbee0ebba1f87ad070c82ad2 100644 (file)
@@ -2,6 +2,10 @@
 
 <suite>
 
+<ajc-test dir="bugs188/484941" title="annotation discovery npe">
+<compile files="Test2.java" options="-1.8 -XnoInline"/>
+</ajc-test>
+
 <ajc-test dir="bugs188/defaultmethods" title="default methods 1">
 <compile files="Code.java" options="-1.8 -XnoInline"/>
 <run class="Code">