jdk-24/test/langtools/tools/javac/analyzer/AnalyzerNotQuiteSpeculative.java
Jan Lahoda 1d71dd8604 8230105: -XDfind=diamond crashes
Avoiding side-effects in Analyzer's speculative attribution.

Reviewed-by: mcimadamore, vromero
2019-08-30 12:24:16 +02:00

26 lines
781 B
Java

/**
* @test /nodynamiccopyright/
* @bug 8230105
* @summary Ensuring speculative analysis on behalf of Analyzers works reasonably.
* @compile/ref=AnalyzerNotQuiteSpeculative.out -XDfind=diamond -XDrawDiagnostics AnalyzerNotQuiteSpeculative.java
*/
public class AnalyzerNotQuiteSpeculative {
private void test() {
Subclass1 c1 = null;
Subclass2 c2 = null;
Base b = null;
t(new C<Base>(c1).set(c2));
t(new C<Base>(b).set(c2));
}
public static class Base {}
public static class Subclass1 extends Base {}
public static class Subclass2 extends Base {}
public class C<T extends Base> {
public C(T t) {}
public C<T> set(T t) { return this; }
}
<T extends Base> void t(C<? extends Base> l) {}
}