aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2016-01-05 13:06:22 -0800
committerAndy Clement <aclement@pivotal.io>2016-01-05 13:06:22 -0800
commitd9029474077ebd405ec34d44913eed3051f2691e (patch)
tree7a6ff9cb209f4fbe15696e3ef31b11c32f0f5fe3
parent9b220fe52ad9bb117140692f7cf455d78a17be11 (diff)
downloadaspectj-d9029474077ebd405ec34d44913eed3051f2691e.tar.gz
aspectj-d9029474077ebd405ec34d44913eed3051f2691e.zip
Fix 484941 - NPE AnnotationDiscoveryVisitor
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java6
-rw-r--r--tests/bugs188/484941/Test2.java10
-rw-r--r--tests/src/org/aspectj/systemtest/ajc188/Ajc188Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc188/ajc188.xml4
4 files changed, 20 insertions, 4 deletions
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 @@
<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">