Skip to content

Failed

org.eclipse.jdt.core.tests.compiler.regression.AmbiguousMethodTest.test081 - 11 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)

Failing for the past 1 build (Since #43 )
Took 0.74 sec.

Error Message

test081 - 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: class B has two methods with the same erasure, yet neither overrides the other\n
 public void set(CharSequence string) {\n
             ^\n
  first method:  set(CharSequence) in I\n
  second method: set(Object) in A\n
C.java:36: warning: [deprecation] newInstance() in Class has been deprecated\n
            return (Type) typeClass.newInstance();\n
                                   ^\n
  where T is a type-variable:\n
    T extends Object declared in class Class\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> {\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: class B has two methods with the same erasure, yet neither overrides the other\n
 public void set(CharSequence string) {\n
             ^\n
  first method:  set(CharSequence) in I\n
  second method: set(Object) in A\n
C.java:36: warning: [deprecation] newInstance() in Class has been deprecated\n
            return (Type) typeClass.newInstance();\n
                                   ^\n
  where T is a type-variable:\n
    T extends Object declared in class Class\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: 
test081 - 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: class B has two methods with the same erasure, yet neither overrides the other\n
	public void set(CharSequence string) {\n
	            ^\n
  first method:  set(CharSequence) in I\n
  second method: set(Object) in A\n
C.java:36: warning: [deprecation] newInstance() in Class has been deprecated\n
            return (Type) typeClass.newInstance();\n
                                   ^\n
  where T is a type-variable:\n
    T extends Object declared in class Class\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> {\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: class B has two methods with the same erasure, yet neither overrides the other\n
	public void set(CharSequence string) {\n
	            ^\n
  first method:  set(CharSequence) in I\n
  second method: set(Object) in A\n
C.java:36: warning: [deprecation] newInstance() in Class has been deprecated\n
            return (Type) typeClass.newInstance();\n
                                   ^\n
  where T is a type-variable:\n
    T extends Object declared in class Class\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.compiler.regression.AmbiguousMethodTest.test081(AmbiguousMethodTest.java:4065)

Standard Output

org.eclipse.jdt.core.tests.compiler.regression.AmbiguousMethodTest#test081 - 11
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> {
	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/genie.jdt/comptest/run.1565427784609/11_20190810_050312.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: class B has two methods with the same erasure, yet neither overrides the other
	public void set(CharSequence string) {
	            ^
  first method:  set(CharSequence) in I
  second method: set(Object) in A
C.java:36: warning: [deprecation] newInstance() in Class has been deprecated
            return (Type) typeClass.newInstance();
                                   ^
  where T is a type-variable:
    T extends Object declared in class Class
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

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