Regression

org.eclipse.jdt.core.tests.compiler.regression.AmbiguousMethodTest.test082 - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)

Failing for the past 1 build (Since Failed#113 )
Took 0.63 sec.

Error Message

test082 - 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> {\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 class 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
4 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> {\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 class 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
4 warnings\n
]>

Stacktrace

junit.framework.ComparisonFailure: 
test082 - 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> {\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 class 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
4 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> {\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 class 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
4 warnings\n
]>
	at org.eclipse.jdt.core.tests.compiler.regression.AmbiguousMethodTest.test082(AmbiguousMethodTest.java:4119)

Standard Output

org.eclipse.jdt.core.tests.compiler.regression.AmbiguousMethodTest#test082 - 1.8
C.java [
class A<ModelType extends D, ValueType> extends 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> {
	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);
        }
    }
}
abstract class I<ModelType, ValueType> {
    public abstract void doSet(ModelType model);
    public abstract void set(ValueType value);
}

]


Full results sent to /tmp/genie.jdt/comptest/run.1566014584562/1.8.0_162_20190817_000312.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> {
                  ^
  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 class 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
4 warnings

----------------------------------------