[java] warn on non-instantiatable intersection types (IDEA-277529)

extend for any context

GitOrigin-RevId: d6f499348c8278bcb58951900ebf116440719082
This commit is contained in:
Anna Kozlova
2021-09-07 07:14:24 +00:00
committed by intellij-monorepo-bot
parent c752c69914
commit 1f0f1acfbc
4 changed files with 36 additions and 36 deletions
@@ -4,7 +4,7 @@ class Test {
}
{
String m <warning descr="Though assignment is formal correct, it could lead to ClassCastException at runtime. Expected: 'String', actual: 'Runnable & String'">=</warning> f();
String m = <warning descr="Intersection type 'Runnable & String' cannot be instantiated, because 'java.lang.String' is final">f</warning>();
System.out.println(m);
}
}