mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-209947 Basic explanations for instanceof
GitOrigin-RevId: 86697e1b8f0a1d905c8b17b732bb01f045e4d4b6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8d1f7ad7c3
commit
137792b1c3
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
Value is always false (s instanceof Integer)
|
||||
Type of 's' is exactly String (s)
|
||||
Type of 's' is known from line #10 (s instanceof String)
|
||||
*/
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
void test(Object s) {
|
||||
if (s instanceof String) {
|
||||
if (<selection>s instanceof Integer</selection>) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Value is always false (s instanceof String)
|
||||
Value 's' is always 'null' (s)
|
||||
's == null' was established from condition (s == null)
|
||||
*/
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
void test(Object s) {
|
||||
if (s == null && <selection>s instanceof String</selection>) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
Value is always true (s instanceof CharSequence)
|
||||
Type of 's' is exactly String (s)
|
||||
Type of 's' is known from line #10 (s instanceof String)
|
||||
*/
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
void test(Object s) {
|
||||
if (s instanceof String) {
|
||||
if (<selection>s instanceof CharSequence</selection>) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user