Files
Tagir Valeevandintellij-monorepo-bot 97b7d32eb0 [java-inspections] PatternVariableCanBeUsed: equivalence check should be performed in narrowing cast as well
Fixes IDEA-348779 "Pattern variable can be used" inspection false positive

GitOrigin-RevId: a1ac8fe39011db2127d8d6d627cfae913320995a
2024-03-13 21:17:22 +00:00

10 lines
277 B
Java

// "Replace 'number' with pattern variable" "false"
class X {
public static void main(String[] args) {
Object o1 = 1.0;
Object o2 = 2;
if (!(o1 instanceof Double)) return;
Number n<caret>umber = (Number) o2;
System.out.println("number = " + number);
}
}