Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java40
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java12
2 files changed, 51 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
index c57ea95c8e..1504327072 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
@@ -9532,4 +9532,44 @@ public void testBug508834_comment0() {
};
runner.runConformTest();
}
+ public void testBug536860() {
+ runConformTest(
+ new String[] {
+ "Snippet.java",
+ "import java.io.IOException;\n" +
+ "import java.io.InputStream;\n" +
+ "import java.nio.file.Path;\n" +
+ "import java.util.Map;\n" +
+ "import java.util.concurrent.Callable;\n" +
+ "import java.util.function.Function;\n" +
+ "\n" +
+ "interface EntityReader<T, S> { }\n" +
+ "class ExtraIOUtils {\n" +
+ " public static Callable<InputStream> getInputStreamProvider() {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "public class Snippet {\n" +
+ " public <T> EntityReader<T, Path> createEntityReader(\n" +
+ " Function<? super String, ? extends String> colNameMapper,\n" +
+ " Function<? super String[], ? extends T> instantiator,\n" +
+ " Map<String, ?> runtimeValues)\n" +
+ " throws IOException {\n" +
+ " EntityReader<T, ?> streamReader =\n" +
+ " createEntityStreamReader(\n" +
+ " ExtraIOUtils.getInputStreamProvider(),\n" +
+ " colNameMapper, instantiator, runtimeValues);\n" +
+ " return null;\n" +
+ " }\n" +
+ " public <T> EntityReader<T, Callable<InputStream>> createEntityStreamReader(\n" +
+ " Callable<InputStream> streamProvider,\n" +
+ " Function<? super String, ? extends String> colNameMapper, Function<? super String[], ? extends T> instantiator,\n" +
+ " Map<String, ?> runtimeValues)\n" +
+ " throws IOException {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n"
+ });
+ }
}
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 6510e346c9..8c298b9264 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -341,6 +341,16 @@ public boolean isSubtypeOf(TypeBinding otherType, boolean simulatingBugJDK802652
return false;
}
return true;
+ case Binding.TYPE_PARAMETER:
+ // check compatibility with capture of ? super X
+ if (otherType.isCapture()) {
+ CaptureBinding otherCapture = (CaptureBinding) otherType;
+ TypeBinding otherLowerBound;
+ if ((otherLowerBound = otherCapture.lowerBound) != null) {
+ if (!otherLowerBound.isArrayType()) return false;
+ return isSubtypeOf(otherLowerBound, simulatingBugJDK8026527);
+ }
+ }
}
switch (otherType.leafComponentType().id) {
case TypeIds.T_JavaLangObject :

Back to the top