[java-inspections] IDEA-287483 Suggest explicit type for uninitialized 'var', based on the first assignment

GitOrigin-RevId: 80fa9ecf09130d04c41d27ad40897ef24183e4e1
This commit is contained in:
Tagir Valeev authored and intellij-monorepo-bot committed 2022-01-28 10:05:00 +00:00
1 parent c7ed6477fb
commit 453a00c310
15 files changed
+177 -4

No files matched your search

@@ -0,0 +1,7 @@
// "Set variable type to 'String'" "true"
public class Demo {
void test() {
String s = null;
s = "hello";
}
}
@@ -0,0 +1,7 @@
// "Set variable type to 'Integer'" "true"
public class Demo {
void test() {
Integer s = null;
s = 123;
}
}
@@ -0,0 +1,7 @@
// "Set variable type to 'int'" "true"
public class Demo {
void test() {
int s;
s = 123;
}
}
@@ -0,0 +1,7 @@
// "Set variable type to 'String'" "true"
public class Demo {
void test() {
String s;
s = "hello";
}
}
@@ -0,0 +1,7 @@
// "Set variable type to 'String'" "true"
public class Demo {
void test() {
v<caret>ar s = null;
s = "hello";
}
}
@@ -0,0 +1,7 @@
// "Set variable type to 'Integer'" "true"
public class Demo {
void test() {
v<caret>ar s = null;
s = 123;
}
}
@@ -0,0 +1,7 @@
// "Set variable type to 'int'" "true"
public class Demo {
void test() {
v<caret>ar s;
s = 123;
}
}
@@ -0,0 +1,7 @@
// "Set variable type to 'String'" "true"
public class Demo {
void test() {
v<caret>ar s;
s = "hello";
}
}