Failed
org.eclipse.jdt.core.tests.compiler.regression.AmbiguousMethodTest.test083 - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)
Error Message
test083 - Javac found error(s) but Eclipse did not find any. ----------- Expected ------------ ------------ but was ------------ C.java:3: warning: [unchecked] unchecked cast\n this.set((ValueType) valueGetter.getObject());\n ^\n required: ValueType\n found: Object\n where ValueType is a type-variable:\n ValueType extends Object declared in class A\n C.java:9: warning: [rawtypes] found raw type: E\n class B extends A<E, CharSequence> implements I<E, CharSequence> {\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:9: warning: [rawtypes] found raw type: E\n class B extends A<E, CharSequence> implements I<E, CharSequence> {\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:10: error: name clash: set(CharSequence) in B overrides a method whose erasure is the same as another method, yet neither overrides the other\n public void set(CharSequence string) {\n ^\n first method: set(Object) in A\n second method: set(ValueType) in I\n where ValueType is a type-variable:\n ValueType extends Object declared in interface I\n C.java:36: warning: [cast] redundant cast to Type\n return (Type) typeClass.newInstance();\n ^\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:20: warning: [rawtypes] found raw type: E\n E e = new E<String>(String.class);\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n 1 error\n 5 warnings\n --------- Difference is ---------- expected:<[]> but was:<[C.java:3: warning: [unchecked] unchecked cast\n this.set((ValueType) valueGetter.getObject());\n ^\n required: ValueType\n found: Object\n where ValueType is a type-variable:\n ValueType extends Object declared in class A\n C.java:9: warning: [rawtypes] found raw type: E\n class B extends A<E, CharSequence> implements I<E, CharSequence> {\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:9: warning: [rawtypes] found raw type: E\n class B extends A<E, CharSequence> implements I<E, CharSequence> {\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:10: error: name clash: set(CharSequence) in B overrides a method whose erasure is the same as another method, yet neither overrides the other\n public void set(CharSequence string) {\n ^\n first method: set(Object) in A\n second method: set(ValueType) in I\n where ValueType is a type-variable:\n ValueType extends Object declared in interface I\n C.java:36: warning: [cast] redundant cast to Type\n return (Type) typeClass.newInstance();\n ^\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:20: warning: [rawtypes] found raw type: E\n E e = new E<String>(String.class);\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n 1 error\n 5 warnings\n ]>
Stacktrace
junit.framework.ComparisonFailure: test083 - Javac found error(s) but Eclipse did not find any. ----------- Expected ------------ ------------ but was ------------ C.java:3: warning: [unchecked] unchecked cast\n this.set((ValueType) valueGetter.getObject());\n ^\n required: ValueType\n found: Object\n where ValueType is a type-variable:\n ValueType extends Object declared in class A\n C.java:9: warning: [rawtypes] found raw type: E\n class B extends A<E, CharSequence> implements I<E, CharSequence> {\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:9: warning: [rawtypes] found raw type: E\n class B extends A<E, CharSequence> implements I<E, CharSequence> {\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:10: error: name clash: set(CharSequence) in B overrides a method whose erasure is the same as another method, yet neither overrides the other\n public void set(CharSequence string) {\n ^\n first method: set(Object) in A\n second method: set(ValueType) in I\n where ValueType is a type-variable:\n ValueType extends Object declared in interface I\n C.java:36: warning: [cast] redundant cast to Type\n return (Type) typeClass.newInstance();\n ^\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:20: warning: [rawtypes] found raw type: E\n E e = new E<String>(String.class);\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n 1 error\n 5 warnings\n --------- Difference is ---------- expected:<[]> but was:<[C.java:3: warning: [unchecked] unchecked cast\n this.set((ValueType) valueGetter.getObject());\n ^\n required: ValueType\n found: Object\n where ValueType is a type-variable:\n ValueType extends Object declared in class A\n C.java:9: warning: [rawtypes] found raw type: E\n class B extends A<E, CharSequence> implements I<E, CharSequence> {\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:9: warning: [rawtypes] found raw type: E\n class B extends A<E, CharSequence> implements I<E, CharSequence> {\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:10: error: name clash: set(CharSequence) in B overrides a method whose erasure is the same as another method, yet neither overrides the other\n public void set(CharSequence string) {\n ^\n first method: set(Object) in A\n second method: set(ValueType) in I\n where ValueType is a type-variable:\n ValueType extends Object declared in interface I\n C.java:36: warning: [cast] redundant cast to Type\n return (Type) typeClass.newInstance();\n ^\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n C.java:20: warning: [rawtypes] found raw type: E\n E e = new E<String>(String.class);\n ^\n missing type arguments for generic class E<Type>\n where Type is a type-variable:\n Type extends CharSequence declared in class E\n 1 error\n 5 warnings\n ]> at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertStringEquals(TestCase.java:260) at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertEquals(TestCase.java:236) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runJavac(AbstractRegressionTest.java:2052) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:2814) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:2539) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runConformTest(AbstractRegressionTest.java:1396) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runConformTest(AbstractRegressionTest.java:1393) at org.eclipse.jdt.core.tests.compiler.regression.AmbiguousMethodTest.test083(AmbiguousMethodTest.java:4155)
Standard Output
org.eclipse.jdt.core.tests.compiler.regression.AmbiguousMethodTest#test083 - 1.8 C.java [ class A<ModelType extends D, ValueType> implements I<ModelType, ValueType> { public void doSet(ModelType valueGetter) { this.set((ValueType) valueGetter.getObject()); } public void set(Object object) { System.out.println("In A.set(Object)"); } } class B extends A<E, CharSequence> implements I<E, CharSequence> { public void set(CharSequence string) { System.out.println("In B.set(CharSequence)"); } } public class C extends B { static public void main(String[] args) { C c = new C(); c.run(); } public void run() { E e = new E<String>(String.class); this.doSet(e); } } class D { public Object getObject() { return null; } } class E<Type extends CharSequence> extends D { private Class<Type> typeClass; public E(Class<Type> typeClass) { this.typeClass = typeClass; } public Type getObject() { try { return (Type) typeClass.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } } } interface I<ModelType, ValueType> { public void doSet(ModelType model); public void set(ValueType value); } ] Full results sent to /tmp/comptest/run.1514610271420/1.8.0_131_20171230_000432.txt
Standard Error
--- javac err: --- C.java:3: warning: [unchecked] unchecked cast this.set((ValueType) valueGetter.getObject()); ^ required: ValueType found: Object where ValueType is a type-variable: ValueType extends Object declared in class A C.java:9: warning: [rawtypes] found raw type: E class B extends A<E, CharSequence> implements I<E, CharSequence> { ^ missing type arguments for generic class E<Type> where Type is a type-variable: Type extends CharSequence declared in class E C.java:9: warning: [rawtypes] found raw type: E class B extends A<E, CharSequence> implements I<E, CharSequence> { ^ missing type arguments for generic class E<Type> where Type is a type-variable: Type extends CharSequence declared in class E C.java:10: error: name clash: set(CharSequence) in B overrides a method whose erasure is the same as another method, yet neither overrides the other public void set(CharSequence string) { ^ first method: set(Object) in A second method: set(ValueType) in I where ValueType is a type-variable: ValueType extends Object declared in interface I C.java:36: warning: [cast] redundant cast to Type return (Type) typeClass.newInstance(); ^ where Type is a type-variable: Type extends CharSequence declared in class E C.java:20: warning: [rawtypes] found raw type: E E e = new E<String>(String.class); ^ missing type arguments for generic class E<Type> where Type is a type-variable: Type extends CharSequence declared in class E 1 error 5 warnings ----------------------------------------