Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorssankaran2014-03-16 01:46:55 +0000
committerssankaran2014-03-16 01:46:55 +0000
commit4026eca435898014ba04ac7657504a426815df33 (patch)
tree56e05ddca0abebcae9fb7f53466cd8da8e1730fc
parenta4ad2d57dad8cd0a00e5934bb21519b3cade23e0 (diff)
downloadeclipse.jdt.core-BETA_JAVA8_LUNA.tar.gz
eclipse.jdt.core-BETA_JAVA8_LUNA.tar.xz
eclipse.jdt.core-BETA_JAVA8_LUNA.zip
Partial fix for Bug 430425 - [1.8][compiler] Type mismatch: cannotBETA_JAVA8_LUNA
convert from StyleConverter<ParsedValue[],Insets> to StyleConverter<ParsedValue[],Insets>
-rw-r--r--org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java68
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java7
2 files changed, 74 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java
index e7dbae9d6d..e1e917624f 100644
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java
+++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.builder;
+import java.io.File;
+
import junit.framework.Test;
import org.eclipse.core.runtime.IPath;
@@ -19,7 +21,7 @@ import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
import org.eclipse.jdt.core.tests.util.Util;
public class IncrementalTests18 extends BuilderTests {
-
+
public IncrementalTests18(String name) {
super(name);
}
@@ -271,4 +273,68 @@ public class IncrementalTests18 extends BuilderTests {
incrementalBuild(projectPath);
expectingNoProblems();
}
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=430425, [1.8][compiler] Type mismatch: cannot convert from StyleConverter<ParsedValue[],Insets> to StyleConverter<ParsedValue[],Insets>
+ public void test430425() throws JavaModelException {
+ IPath projectPath = env.addProject("Project", "1.8");
+ String jreDirectory = Util.getJREDirectory();
+ String jfxJar = Util.toNativePath(jreDirectory + "/lib/ext/jfxrt.jar");
+ File file = new File(jfxJar);
+ if (file.exists())
+ env.addExternalJars(projectPath, Util.concatWithClassLibs(jfxJar, false));
+ else
+ return;
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "javafx.css", "StyleConverter",
+ "package javafx.css;\n" +
+ "import com.sun.javafx.css.converters.InsetsConverter;\n" +
+ "import javafx.geometry.Insets;\n" +
+ "public class StyleConverter<F, T> {\n" +
+ " public static StyleConverter<ParsedValue[], Insets> getInsetsConverter() {\n" +
+ " return InsetsConverter.getInstance();\n" +
+ " }\n" +
+ " void fred5555() {\n" +
+ " }\n" +
+ "}\n"
+ );
+ env.addClass(root, "com.sun.javafx.css.converters", "InsetsConverter",
+ "package com.sun.javafx.css.converters;\n" +
+ "import com.sun.javafx.css.StyleConverterImpl;\n" +
+ "import javafx.css.ParsedValue;\n" +
+ "import javafx.css.StyleConverter;\n" +
+ "import javafx.geometry.Insets;\n" +
+ "public final class InsetsConverter extends StyleConverterImpl<ParsedValue[], Insets> {\n" +
+ " public static StyleConverter<ParsedValue[], Insets> getInstance() {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n"
+ );
+ env.addClass(root, "javafx.css", "ParsedValue",
+ "package javafx.css;\n" +
+ "public class ParsedValue<V, T> {\n" +
+ "}\n"
+ );
+ env.getJavaProject("Project").setOption(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.IGNORE);
+ fullBuild(projectPath);
+ expectingNoProblems();
+ env.addClass(root, "javafx.css", "StyleConverter",
+ "package javafx.css;\n" +
+ "import com.sun.javafx.css.converters.InsetsConverter;\n" +
+ "import javafx.geometry.Insets;\n" +
+ "public class StyleConverter<F, T> {\n" +
+ " public static StyleConverter<ParsedValue[], Insets> getInsetsConverter() {\n" +
+ " return InsetsConverter.getInstance();\n" +
+ " }\n" +
+ " void fred555() {\n" +
+ " }\n" +
+ "}\n"
+ );
+ incrementalBuild(projectPath);
+ expectingNoProblems();
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
index b1536ab1d2..4124f49d66 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
@@ -438,6 +438,13 @@ public char[] sourceName() {
public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
if (this.leafComponentType == unresolvedType) { //$IDENTITY-COMPARISON$
this.leafComponentType = env.convertUnresolvedBinaryToRawType(resolvedType);
+ /* Leaf component type is the key in the type system. If it undergoes change, the array has to be rehashed.
+ We achieve by creating a fresh array with the new component type and equating this array's id with that.
+ This means this array can still be found under the old key, but that is harmless (since the component type
+ is always consulted (see TypeSystem.getArrayType())
+ */
+ if (this.leafComponentType != resolvedType) //$IDENTITY-COMPARISON$
+ this.id = env.createArrayType(this.leafComponentType, this.dimensions, this.typeAnnotations).id;
this.tagBits |= this.leafComponentType.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard | TagBits.HasMissingType | TagBits.HasCapturedWildcard);
}
}

Back to the top