Skip to content

Failed

org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_7.test448028 - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)

Failing for the past 2 builds (Since #167 )
Took 0.73 sec.

Error Message

test448028 - Eclipse found error(s) but Javac did not find any.
----------- Expected ------------

------------ but was ------------
----------\n
1. ERROR in X.java (at line 34)\n
 return inspect(new W<C>(c, o)); // - WARNING: Redundant specification of type arguments <F.C> F.java\n
                    ^\n
Redundant specification of type arguments <X.C>\n
----------\n

--------- Difference is ----------
 expected:<[]> but was:<[----------\n
1. ERROR in X.java (at line 34)\n
 return inspect(new W<C>(c, o)); // - WARNING: Redundant specification of type arguments <F.C> F.java\n
                    ^\n
Redundant specification of type arguments <X.C>\n
----------\n
]>

Stacktrace

junit.framework.ComparisonFailure: 
test448028 - Eclipse found error(s) but Javac did not find any.
----------- Expected ------------

------------ but was ------------
----------\n
1. ERROR in X.java (at line 34)\n
	return inspect(new W<C>(c, o)); // - WARNING: Redundant specification of type arguments <F.C> F.java\n
	                   ^\n
Redundant specification of type arguments <X.C>\n
----------\n

--------- Difference is ----------
 expected:<[]> but was:<[----------\n
1. ERROR in X.java (at line 34)\n
	return inspect(new W<C>(c, o)); // - WARNING: Redundant specification of type arguments <F.C> F.java\n
	                   ^\n
Redundant specification of type arguments <X.C>\n
----------\n
]>
	at org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_7.test448028(GenericsRegressionTest_1_7.java:2756)

Standard Output

org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_7#test448028 - 1.8
X.java [
public class X {

  public static interface I {/*empty*/}

  public static class C
    implements I {/*empty*/}

  public static class W<T extends I>
    implements I {

    // --- problem is triggered only, when there is a vararg-parameter
    public W(final T t, final Object... o) {
      super();
    }
  }

  // --- needed to trigger problem
  public static final <T> T inspect(final T t) {
    return t;
  }

  // --- this compiles ok when having JDK Compilance set to 1.7 !
  public static final W<C> err1() {
    final C c = new C();
    final Object o = new Object();
    return inspect(new W<>(c, o)); // - ERROR: Cannot infer type arguments for W<> F.java
  }

  public static final W<C> wrn1() {
    final C c = new C();
    final Object o = new Object();
    // --- giving the type-parameter yields a warning
    // --- comparing that to the error of method err1() it does not make much sense
    return inspect(new W<C>(c, o)); // - WARNING: Redundant specification of type arguments <F.C> F.java
  }

  public static final W<C> ok1() {
    final C c = new C();
    // --- no extra vararg-paramaeter
    return inspect(new W<>(c)); // - OK
  }

  public static final W<C> ok2() {
    final C c = new C();
    final Object o = new Object();
    // --- no check-method
    return new W<>(c, o); // - OK
  }

  public static final W<C> ok3() {
    final C c = new C();
    // --- no check-method
    return new W<>(c); // - OK
  }

  public static final W<C> ok4() {
    final C c = new C();
    final Object o = new Object();
    // --- this also compiles (my solution for now)
    final W<C> w = new W<>(c, o);
    return inspect(w);
  }
}

]


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

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