[java-inspections] A test with loop for CastCanBeReplacedWithVariable inspection

GitOrigin-RevId: 4b785ae09e7e5adc579a8ac37e3bc671ac559517
This commit is contained in:
Tagir Valeev
2022-10-26 15:49:37 +00:00
committed by intellij-monorepo-bot
parent f84e0b42a8
commit 552ffd1a79
2 changed files with 24 additions and 0 deletions
@@ -0,0 +1,12 @@
// "Replace '(String) obj' with 's'" "true"
class X {
void test(Object obj) {
for (int i = 0; i < 10; i++) {
String s = (String) obj;
System.out.println(s);
System.out.println(s);
s = null;
}
}
}
@@ -0,0 +1,12 @@
// "Replace '(String) obj' with 's'" "true"
class X {
void test(Object obj) {
for (int i = 0; i < 10; i++) {
String s = (String) obj;
System.out.println(s);
System.out.println((String<caret>) obj);
s = null;
}
}
}