Failed
org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_8.testBug521978 - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)
Error Message
testBug521978 - Eclipse found error(s) but Javac only found warning(s). ----------- Expected ------------ ----------\n 1. ERROR in Test.java (at line 17)\n method(getBar(\n ^^^^^^\n The method method(Bar<? extends Foo<Q>>) in the type Test is not applicable for the arguments (Bar<Foo>)\n ----------\n 2. WARNING in Test.java (at line 18)\n new Foo<>("str", new ArrayList())\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n Type safety: The constructor Foo(Object, List) belongs to the raw type Foo. References to generic type Foo<T> should be parameterized\n ----------\n 3. WARNING in Test.java (at line 18)\n new Foo<>("str", new ArrayList())\n ^^^^^^^^^\n ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n ----------\n ------------ but was ------------ Test.java:18: warning: [rawtypes] found raw type: ArrayList\n new Foo<>("str", new ArrayList())\n ^\n missing type arguments for generic class ArrayList<E>\n where E is a type-variable:\n E extends Object declared in class ArrayList\n Test.java:18: warning: [unchecked] unchecked method invocation: constructor <init> in class Foo is applied to given types\n new Foo<>("str", new ArrayList())\n ^\n required: T,List<String>\n found: String,ArrayList\n where T is a type-variable:\n T extends Object declared in class Foo\n Test.java:18: warning: [unchecked] unchecked conversion\n new Foo<>("str", new ArrayList())\n ^\n required: List<String>\n found: ArrayList\n Test.java:17: warning: [unchecked] unchecked method invocation: method getBar in class Test is applied to given types\n method(getBar(\n ^\n required: T\n found: Foo\n where T is a type-variable:\n T extends Object declared in method <T>getBar(T)\n Test.java:17: warning: [unchecked] unchecked method invocation: method method in class Test is applied to given types\n method(getBar(\n ^\n required: Bar<? extends Foo<Q>>\n found: Bar\n where Q is a type-variable:\n Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>)\n Test.java:17: warning: [unchecked] unchecked conversion\n method(getBar(\n ^\n required: Bar<? extends Foo<Q>>\n found: Bar\n where Q is a type-variable:\n Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>)\n 6 warnings\n --------- Difference is ---------- expected:<[----------\n 1. ERROR in Test.java (at line 17)\n method(getBar(\n ^^^^^^\n The method method(Bar<? extends Foo<Q>>) in the type Test is not applicable for the arguments (Bar<Foo>)\n ----------\n 2. WARNING in Test.java (at line 18)\n new Foo<>("str", new ArrayList())\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n Type safety: The constructor Foo(Object, List) belongs to the raw type Foo. References to generic type Foo<T> should be parameterized\n ----------\n 3. WARNING in Test.java (at line 18)\n new Foo<>("str", new ArrayList())\n ^^^^^^^^^\n ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n ----------]\n > but was:<[Test.java:18: warning: [rawtypes] found raw type: ArrayList\n new Foo<>("str", new ArrayList())\n ^\n missing type arguments for generic class ArrayList<E>\n where E is a type-variable:\n E extends Object declared in class ArrayList\n Test.java:18: warning: [unchecked] unchecked method invocation: constructor <init> in class Foo is applied to given types\n new Foo<>("str", new ArrayList())\n ^\n required: T,List<String>\n found: String,ArrayList\n where T is a type-variable:\n T extends Object declared in class Foo\n Test.java:18: warning: [unchecked] unchecked conversion\n new Foo<>("str", new ArrayList())\n ^\n required: List<String>\n found: ArrayList\n Test.java:17: warning: [unchecked] unchecked method invocation: method getBar in class Test is applied to given types\n method(getBar(\n ^\n required: T\n found: Foo\n where T is a type-variable:\n T extends Object declared in method <T>getBar(T)\n Test.java:17: warning: [unchecked] unchecked method invocation: method method in class Test is applied to given types\n method(getBar(\n ^\n required: Bar<? extends Foo<Q>>\n found: Bar\n where Q is a type-variable:\n Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>)\n Test.java:17: warning: [unchecked] unchecked conversion\n method(getBar(\n ^\n required: Bar<? extends Foo<Q>>\n found: Bar\n where Q is a type-variable:\n Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>)\n 6 warnings]\n >
Stacktrace
junit.framework.ComparisonFailure: testBug521978 - Eclipse found error(s) but Javac only found warning(s). ----------- Expected ------------ ----------\n 1. ERROR in Test.java (at line 17)\n method(getBar(\n ^^^^^^\n The method method(Bar<? extends Foo<Q>>) in the type Test is not applicable for the arguments (Bar<Foo>)\n ----------\n 2. WARNING in Test.java (at line 18)\n new Foo<>("str", new ArrayList())\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n Type safety: The constructor Foo(Object, List) belongs to the raw type Foo. References to generic type Foo<T> should be parameterized\n ----------\n 3. WARNING in Test.java (at line 18)\n new Foo<>("str", new ArrayList())\n ^^^^^^^^^\n ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n ----------\n ------------ but was ------------ Test.java:18: warning: [rawtypes] found raw type: ArrayList\n new Foo<>("str", new ArrayList())\n ^\n missing type arguments for generic class ArrayList<E>\n where E is a type-variable:\n E extends Object declared in class ArrayList\n Test.java:18: warning: [unchecked] unchecked method invocation: constructor <init> in class Foo is applied to given types\n new Foo<>("str", new ArrayList())\n ^\n required: T,List<String>\n found: String,ArrayList\n where T is a type-variable:\n T extends Object declared in class Foo\n Test.java:18: warning: [unchecked] unchecked conversion\n new Foo<>("str", new ArrayList())\n ^\n required: List<String>\n found: ArrayList\n Test.java:17: warning: [unchecked] unchecked method invocation: method getBar in class Test is applied to given types\n method(getBar(\n ^\n required: T\n found: Foo\n where T is a type-variable:\n T extends Object declared in method <T>getBar(T)\n Test.java:17: warning: [unchecked] unchecked method invocation: method method in class Test is applied to given types\n method(getBar(\n ^\n required: Bar<? extends Foo<Q>>\n found: Bar\n where Q is a type-variable:\n Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>)\n Test.java:17: warning: [unchecked] unchecked conversion\n method(getBar(\n ^\n required: Bar<? extends Foo<Q>>\n found: Bar\n where Q is a type-variable:\n Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>)\n 6 warnings\n --------- Difference is ---------- expected:<[----------\n 1. ERROR in Test.java (at line 17)\n method(getBar(\n ^^^^^^\n The method method(Bar<? extends Foo<Q>>) in the type Test is not applicable for the arguments (Bar<Foo>)\n ----------\n 2. WARNING in Test.java (at line 18)\n new Foo<>("str", new ArrayList())\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n Type safety: The constructor Foo(Object, List) belongs to the raw type Foo. References to generic type Foo<T> should be parameterized\n ----------\n 3. WARNING in Test.java (at line 18)\n new Foo<>("str", new ArrayList())\n ^^^^^^^^^\n ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n ----------]\n > but was:<[Test.java:18: warning: [rawtypes] found raw type: ArrayList\n new Foo<>("str", new ArrayList())\n ^\n missing type arguments for generic class ArrayList<E>\n where E is a type-variable:\n E extends Object declared in class ArrayList\n Test.java:18: warning: [unchecked] unchecked method invocation: constructor <init> in class Foo is applied to given types\n new Foo<>("str", new ArrayList())\n ^\n required: T,List<String>\n found: String,ArrayList\n where T is a type-variable:\n T extends Object declared in class Foo\n Test.java:18: warning: [unchecked] unchecked conversion\n new Foo<>("str", new ArrayList())\n ^\n required: List<String>\n found: ArrayList\n Test.java:17: warning: [unchecked] unchecked method invocation: method getBar in class Test is applied to given types\n method(getBar(\n ^\n required: T\n found: Foo\n where T is a type-variable:\n T extends Object declared in method <T>getBar(T)\n Test.java:17: warning: [unchecked] unchecked method invocation: method method in class Test is applied to given types\n method(getBar(\n ^\n required: Bar<? extends Foo<Q>>\n found: Bar\n where Q is a type-variable:\n Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>)\n Test.java:17: warning: [unchecked] unchecked conversion\n method(getBar(\n ^\n required: Bar<? extends Foo<Q>>\n found: Bar\n where Q is a type-variable:\n Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>)\n 6 warnings]\n > at org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_8.testBug521978(GenericsRegressionTest_1_8.java:8455)
Standard Output
org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_8#testBug521978 - 1.8 Test.java [ import java.util.ArrayList; import java.util.List; class Foo<T> { public Foo(T a1, List<String> a2){ } } class Bar<T> { Bar(T item) { } } public class Test { static <T> Bar<T> getBar(T item) { return new Bar<>(item); } static <Q> Foo<Q> method(Bar<? extends Foo<Q>> f) { return null; } static void test() { method(getBar( new Foo<>("str", new ArrayList()) )); } } ] Full results sent to /home/jenkins/agent/workspace/eclipse.jdt.core-run.javac-1.8/tmp/comptest/run.1584479137560/1.8.0_202_20200317_210541.txt
Standard Error
--- javac err: --- Test.java:18: warning: [rawtypes] found raw type: ArrayList new Foo<>("str", new ArrayList()) ^ missing type arguments for generic class ArrayList<E> where E is a type-variable: E extends Object declared in class ArrayList Test.java:18: warning: [unchecked] unchecked method invocation: constructor <init> in class Foo is applied to given types new Foo<>("str", new ArrayList()) ^ required: T,List<String> found: String,ArrayList where T is a type-variable: T extends Object declared in class Foo Test.java:18: warning: [unchecked] unchecked conversion new Foo<>("str", new ArrayList()) ^ required: List<String> found: ArrayList Test.java:17: warning: [unchecked] unchecked method invocation: method getBar in class Test is applied to given types method(getBar( ^ required: T found: Foo where T is a type-variable: T extends Object declared in method <T>getBar(T) Test.java:17: warning: [unchecked] unchecked method invocation: method method in class Test is applied to given types method(getBar( ^ required: Bar<? extends Foo<Q>> found: Bar where Q is a type-variable: Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>) Test.java:17: warning: [unchecked] unchecked conversion method(getBar( ^ required: Bar<? extends Foo<Q>> found: Bar where Q is a type-variable: Q extends Object declared in method <Q>method(Bar<? extends Foo<Q>>) 6 warnings ----------------------------------------