diff options
author | Stephan Herrmann | 2017-04-14 13:37:43 +0000 |
---|---|---|
committer | Stephan Herrmann | 2017-04-14 13:38:47 +0000 |
commit | 33c2bbf0853e7d7634881ee1cdbec339eec8d40e (patch) | |
tree | 25133279a65292ef70782d30bca08ab67a55fc7b /org.eclipse.jdt.core.tests.compiler | |
parent | 82a37a244511a78abb719184529dbacc5eee9f6c (diff) | |
download | eclipse.jdt.core-33c2bbf0853e7d7634881ee1cdbec339eec8d40e.tar.gz eclipse.jdt.core-33c2bbf0853e7d7634881ee1cdbec339eec8d40e.tar.xz eclipse.jdt.core-33c2bbf0853e7d7634881ee1cdbec339eec8d40e.zip |
Bug 484713: [1.8][inference] ProblemReporter.invalidMethod() mightI20170414-2000
swallow mandatory error in case of InvocationTypeInferenceFailure
Change-Id: I2ec52d46f3e236374313dfc31f4337f15ecae693
Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler')
2 files changed, 45 insertions, 0 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 5345775d7d..d5985f147a 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 @@ -8165,4 +8165,39 @@ public void testBug508834_comment0() { "Type mismatch: cannot convert from List<Integer> to List<Object>\n" + "----------\n"); } + + public void test483952_bare () { + runNegativeTest( + new String[] { + "test/Test.java", + "package test;\n" + + "import java.util.function.Function;\n" + + "public class Test {\n" + + " void test1() {\n" + + " Function function = x -> x;\n" + + " String [] z = test2(function, \"\");\n" + + " }\n" + + " <T> T [] test2(Function<T, T> function, T t) {\n" + + " return null;\n" + + " }\n" + + "}" + + }, + "----------\n" + + "1. WARNING in test\\Test.java (at line 5)\n" + + " Function function = x -> x;\n" + + " ^^^^^^^^\n" + + "Function is a raw type. References to generic type Function<T,R> should be parameterized\n" + + "----------\n" + + "2. WARNING in test\\Test.java (at line 6)\n" + + " String [] z = test2(function, \"\");\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Type safety: Unchecked invocation test2(Function, String) of the generic method test2(Function<T,T>, T) of type Test\n" + + "----------\n" + + "3. WARNING in test\\Test.java (at line 6)\n" + + " String [] z = test2(function, \"\");\n" + + " ^^^^^^^^\n" + + "Type safety: The expression of type Function needs unchecked conversion to conform to Function<String,String>\n" + + "----------\n"); + } } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java index 6478082e3e..f93b5980d1 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java @@ -9323,6 +9323,16 @@ public void test483952 () { " Function function = x -> x;\n" + " ^^^^^^^^\n" + "Function is a raw type. References to generic type Function<T,R> should be parameterized\n" + + "----------\n" + + "2. WARNING in test\\Test.java (at line 7)\n" + + " String @Nullable [] z = test2(function, \"\");\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Type safety: Unchecked invocation test2(Function, String) of the generic method test2(Function<T,T>, T) of type Test\n" + + "----------\n" + + "3. WARNING in test\\Test.java (at line 7)\n" + + " String @Nullable [] z = test2(function, \"\");\n" + + " ^^^^^^^^\n" + + "Type safety: The expression of type Function needs unchecked conversion to conform to Function<String,String>\n" + "----------\n"); } public void test484055() { |