diff options
author | Stephan Herrmann | 2012-07-28 11:04:02 -0400 |
---|---|---|
committer | Jayaprakash Arthanareeswaran | 2012-08-10 02:59:12 -0400 |
commit | 530988a731872b445321868ef3627a37fb897b2a (patch) | |
tree | a4bd9411b230750eef34250e1175b8e7e32be560 | |
parent | 2e33cdeb9616845f88ead8d0dae1883377e24723 (diff) | |
download | eclipse.jdt.core-530988a731872b445321868ef3627a37fb897b2a.zip eclipse.jdt.core-530988a731872b445321868ef3627a37fb897b2a.tar.gz eclipse.jdt.core-530988a731872b445321868ef3627a37fb897b2a.tar.xz |
Fixed bug 384663 - Package Based Annotation Compilation Error in JDT
3.8/4.2 (works in 3.7.2)
Change-Id: Iee1685b7897675e2a4cefba147bad99e71304611
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 fcf0e9d..10ae129 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; |