mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
GitOrigin-RevId: 593fe7a65d81e8444eaa6e5a3c8b5904ceda8d5e
38 lines
771 B
Java
38 lines
771 B
Java
class FieldCouldBeUsedOutside {
|
|
|
|
static class CheckCase {
|
|
int notUsed = <warning descr="Variable 'notUsed' initializer '1' is redundant">1</warning>;
|
|
public CheckCase(){
|
|
notUsed = 2;
|
|
}
|
|
}
|
|
|
|
static class InnerMethod {
|
|
int useInAnotherMethod = 1;
|
|
public InnerMethod(){
|
|
check();
|
|
useInAnotherMethod = 2;
|
|
}
|
|
|
|
private void check() {
|
|
if (useInAnotherMethod == 1) {
|
|
System.out.println("1");
|
|
}
|
|
}
|
|
}
|
|
|
|
static class CallWithThis {
|
|
int useInAnotherMethod = 1;
|
|
|
|
public CallWithThis() {
|
|
check(this);
|
|
useInAnotherMethod = 2;
|
|
}
|
|
|
|
private static void check(CallWithThis innerMethod) {
|
|
if (innerMethod.useInAnotherMethod == 1) {
|
|
System.out.println("1");
|
|
}
|
|
}
|
|
}
|
|
} |