[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
2022-01-27 14:26:09 +07:00
committed by intellij-monorepo-bot
parent c7ed6477fb
commit 453a00c310
15 changed files with 177 additions and 4 deletions

View File

@@ -0,0 +1,7 @@
// "Set variable type to 'String'" "true"
public class Demo {
void test() {
String s = null;
s = "hello";
}
}

View File

@@ -0,0 +1,7 @@
// "Set variable type to 'Integer'" "true"
public class Demo {
void test() {
Integer s = null;
s = 123;
}
}

View File

@@ -0,0 +1,7 @@
// "Set variable type to 'int'" "true"
public class Demo {
void test() {
int s;
s = 123;
}
}

View File

@@ -0,0 +1,7 @@
// "Set variable type to 'String'" "true"
public class Demo {
void test() {
String s;
s = "hello";
}
}

View File

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

View File

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

View File

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

View File

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