mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] IDEA-274033: Inspection to convert instanceof pattern to old school instanceof. add tests
GitOrigin-RevId: 393b56ff099abd3a02ffceb425309d1bbad51bdc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4ac4c28a09
commit
5d52119cc6
+2
-1
@@ -98,7 +98,8 @@ public class PatternVariablesCanBeReplacedWithCastInspection extends AbstractBas
|
||||
PsiElement parent = current.getParent();
|
||||
while (parent instanceof PsiParenthesizedExpression ||
|
||||
parent instanceof PsiPolyadicExpression ||
|
||||
parent instanceof PsiPrefixExpression) {
|
||||
parent instanceof PsiPrefixExpression ||
|
||||
parent instanceof PsiConditionalExpression) {
|
||||
current = parent;
|
||||
parent = current.getParent();
|
||||
}
|
||||
|
||||
+5
@@ -275,4 +275,9 @@ public class Simple{
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ternary(Object object) {
|
||||
String result = object instanceof String ? (String) object : "1";
|
||||
String result2 = object instanceof String text ? text = "2" : "1";
|
||||
}
|
||||
}
|
||||
+5
@@ -234,4 +234,9 @@ public class Simple{
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ternary(Object object) {
|
||||
String result = object instanceof String text ? text : "1";
|
||||
String result2 = object instanceof String text ? text = "2" : "1";
|
||||
}
|
||||
}
|
||||
+5
@@ -265,4 +265,9 @@ public class Simple{
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ternary(Object object) {
|
||||
String result = object instanceof String ? (String) object : "1";
|
||||
String result2 = object instanceof String text ? text = "2" : "1";
|
||||
}
|
||||
}
|
||||
+5
@@ -234,4 +234,9 @@ public class Simple{
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ternary(Object object) {
|
||||
String result = object instanceof String text ? text : "1";
|
||||
String result2 = object instanceof String text ? text = "2" : "1";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user