Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorssankaran2013-12-19 03:42:29 +0000
committerssankaran2013-12-19 03:42:29 +0000
commite77a13c5cfd8a2800f9cc3d46536a8ccdc632a8b (patch)
tree5fc3e21688ddddd209fc3cc41dc954b8f5aa04fa
parentd5ddc462d972762fef01fd12ff7f5dd333495394 (diff)
downloadeclipse.jdt.core-e77a13c5cfd8a2800f9cc3d46536a8ccdc632a8b.tar.gz
eclipse.jdt.core-e77a13c5cfd8a2800f9cc3d46536a8ccdc632a8b.tar.xz
eclipse.jdt.core-e77a13c5cfd8a2800f9cc3d46536a8ccdc632a8b.zip
Fixed Bug 423849 - [1.8][compiler] cannot implement java.nio.file.Path
because of compiler name clash
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java23
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java3
2 files changed, 26 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
index c94129efcb..71e90f104b 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
@@ -14034,4 +14034,27 @@ public void testBug415600() {
"class C extends B<StringReader> { }\n"
});
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=423849, [1.8][compiler] cannot implement java.nio.file.Path because of compiler name clash
+public void test423849() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "import java.io.IOException;\n" +
+ "import java.nio.file.Path;\n" +
+ "import java.nio.file.WatchEvent.Kind;\n" +
+ "import java.nio.file.WatchEvent.Modifier;\n" +
+ "import java.nio.file.WatchKey;\n" +
+ "import java.nio.file.WatchService;\n" +
+ "abstract class Y implements Path {\n" +
+ " public WatchKey register(WatchService watcher, Kind<?>[] events, Modifier... modifiers) throws IOException {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String [] args) {\n" +
+ " System.out.println(\"OK\");\n" +
+ " }\n" +
+ "}\n"
+ });
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
index 38115fa68d..467444d314 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
@@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
import org.eclipse.jdt.internal.compiler.util.Util;
@@ -72,6 +73,8 @@ public class TypeSystem {
// Given a type, answer its unannotated aka naked prototype. This is also a convenient way to "register" a type with TypeSystem and have it id stamped.
public final TypeBinding getUnannotatedType(TypeBinding type) {
+ if (type.isUnresolvedType() && CharOperation.indexOf('$', type.sourceName()) > 0)
+ type = BinaryTypeBinding.resolveType(type, this.environment, true); // to ensure unique id assignment (when enclosing type is parameterized, inner type is also)
if (type.id == TypeIds.NoId) {
if (type.hasTypeAnnotations())
throw new IllegalStateException();

Back to the top