diamonds: simulate resolved constructor with generated static factory (IDEA-195813)

This commit is contained in:
Anna.Kozlova
2018-07-23 19:20:55 +02:00
parent 2cc2fb05eb
commit 16f0977481
3 changed files with 33 additions and 2 deletions
@@ -0,0 +1,17 @@
import java.util.function.Supplier;
class Foo {
private final Singleton<B> singletonB = new Singleton<>(() -> f());
static B f() {
return null;
}
}
interface B {
String getData();
}
class Singleton<T> {
public Singleton(Supplier<T> supplier) { }
public Singleton(T instance) { }
}