aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2012-07-28 11:04:02 (EDT)
committerStephan Herrmann2012-07-28 11:04:02 (EDT)
commit19d165e647c4c3cdf16627c1161435f046ff5fb5 (patch)
tree6861dd74bd7beac9337debeae0d57b9319dfb611
parent0ea94b3bc4c5e078eb093b28f131291ec21a0c74 (diff)
downloadeclipse.jdt.core-19d165e647c4c3cdf16627c1161435f046ff5fb5.zip
eclipse.jdt.core-19d165e647c4c3cdf16627c1161435f046ff5fb5.tar.gz
eclipse.jdt.core-19d165e647c4c3cdf16627c1161435f046ff5fb5.tar.bz2
Fixed bug 384663 - Package Based Annotation Compilation Error in JDTv20120728-150402
3.8/4.2 (works in 3.7.2) Change-Id: Iee1685b7897675e2a4cefba147bad99e71304611
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java31
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java5
2 files changed, 35 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
index 875c58e..c5a75b4 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
@@ -11,6 +11,7 @@
* bug 295551 - Add option to automatically promote all warnings to error
* bug 185682 - Increment/decrement operators mark local variables as read
* bug 366003 - CCE in ASTNode.resolveAnnotations(ASTNode.java:639)
+ * bug 384663 - Package Based Annotation Compilation Error in JDT 3.8/4.2 (works in 3.7.2)
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
@@ -47,7 +48,7 @@ public class AnnotationTest extends AbstractComparableTest {
// Static initializer to specify tests subset using TESTS_* static variables
// All specified tests which do not belong to the class are skipped...
static {
-// TESTS_NAMES = new String[] { "testBug376429" };
+// TESTS_NAMES = new String[] { "testBug384663" };
// TESTS_NUMBERS = new int[] { 297 };
// TESTS_RANGE = new int[] { 294, -1 };
}
@@ -10608,4 +10609,32 @@ public void testBug371832() throws Exception {
expectedErrorString,
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
}
+// https://bugs.eclipse.org/384663
+// Package Based Annotation Compilation Error in JDT 3.8/4.2 (works in 3.7.2)
+public void testBug384663() {
+ String[] testFiles = {
+ "annotations/test/IExtendsInterface.java",
+ "package annotations.test;\n" +
+ "public interface IExtendsInterface extends Interface {}\n",
+
+ "annotations/test/Interface.java",
+ "package annotations.test;\n" +
+ "public interface Interface {}\n",
+
+ "annotations/test/package-info.java",
+ "@AnnotationDefinition(\"Test1\") \n" +
+ "package annotations.test;\n" +
+ "import annotations.AnnotationDefinition;",
+
+ "annotations/AnnotationDefinition.java",
+ "package annotations;\n" +
+ "import java.lang.annotation.*;\n" +
+ "@Retention(RetentionPolicy.RUNTIME)\n" +
+ "@Target(ElementType.PACKAGE)\n" +
+ "public @interface AnnotationDefinition {\n" +
+ " String value();\n" +
+ "}",
+ };
+ runConformTest(testFiles);
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 901769c..a8fbc59 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -16,6 +16,7 @@
* bug 365662 - [compiler][null] warn on contradictory and redundant null annotations
* bug 365531 - [compiler][null] investigate alternative strategy for internally encoding nullness defaults
* bug 366063 - Compiler should not add synthetic @NonNull annotations
+ * bug 384663 - Package Based Annotation Compilation Error in JDT 3.8/4.2 (works in 3.7.2)
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -1180,6 +1181,10 @@ public MethodBinding[] methods() {
if ((this.tagBits & TagBits.AreMethodsComplete) != 0)
return this.methods;
+ if (!areMethodsInitialized()) { // https://bugs.eclipse.org/384663
+ this.scope.buildMethods();
+ }
+
// lazily sort methods
if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
int length = this.methods.length;