mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-193288 Inspection to detect Xyz.class.isInstance(foo) and Xyz.class.cast(foo)
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with '(Integer)'" "true"
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if(Integer.class.isInstance(obj)) {
|
||||
System.out.println((Integer) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with 'instanceof Integer'" "true"
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if(obj instanceof Integer) {
|
||||
System.out.println("Integer");
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with '(Integer)'" "true"
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if(Integer.class.isInstance(obj)) {
|
||||
System.out.println(Integer.class.c<caret>ast(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with 'instanceof Integer'" "true"
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if(Integer.class.isIns<caret>tance(obj)) {
|
||||
System.out.println("Integer");
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with 'instanceof Integer'" "false"
|
||||
class X {
|
||||
void test(String obj) {
|
||||
if(Integer.class.isIns<caret>tance(obj)) {
|
||||
System.out.println("Integer");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user