Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingPatterns/InstanceOfNonReified.java
Tagir Valeev 9b9e75531c [java-highlighting] Fix pattern type inference for wildcard-parameterized patterns
Also: fix and unify unchecked warnings for patterns
#IDEA-312000 fixed

GitOrigin-RevId: 8f47b72ec308cc9b089571ddc486d275d5d8ff4e
2023-02-07 12:02:04 +00:00

22 lines
744 B
Java

import java.util.ArrayList;
import java.util.List;
interface Iface {}
class Cls implements Iface {}
class Foo<T> {}
class InstanceOfNonReified {
void test(List<Cls> o) {
boolean b1 = o instanceof ArrayList<Cls>;
boolean b2 = <error descr="Inconvertible types; cannot cast 'java.util.List<Cls>' to 'java.util.ArrayList<Iface>'">o instanceof ArrayList<Iface></error>;
boolean b3 = o instanceof <error descr="'List<Cls>' cannot be safely cast to 'Foo<Cls>'">Foo<Cls></error>;
}
public static void main(String [] args) {
Object o = new ArrayList<Object>();
if (o instanceof <error descr="'Object' cannot be safely cast to 'ArrayList<Integer>'">ArrayList<Integer> ai</error>) {
System.out.println("");
}
}
}