mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
22 lines
414 B
Java
22 lines
414 B
Java
import org.jetbrains.annotations.*;
|
|
|
|
public class FieldLocalNoAliasing {
|
|
static class X {
|
|
int a = 1;
|
|
}
|
|
|
|
void noAliasingPossible(X b) {
|
|
X x = getX();
|
|
x.a = 1;
|
|
b.a = 211;
|
|
if (<warning descr="Condition 'x.a == 1' is always 'true'">x.a == 1</warning>) {
|
|
System.out.println("1");
|
|
}
|
|
}
|
|
|
|
@Contract(value="->new", pure=true)
|
|
private X getX(){
|
|
X x = new X();
|
|
return x;
|
|
}
|
|
} |