Local variable used and declared in different 'switch' branches
Reports local variables declared in one branch of a switch
statement and used in another branch. Such declarations can be extremely confusing.
Example:
switch(i) {
case 2:
int x = 0;
break;
case 3:
x = 3;
System.out.println(x);
break;
}
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023