blob: f1898cfd8caab738328d9b0415abf833627ddbf6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// version :9
import lombok.val;
public class ValComplex {
private String field = "";
private static final int CONSTANT = 20;
public void testComplex() {
val shouldBeCharArray = field.toCharArray();
val shouldBeInt = CONSTANT;
val lock = new Object();
synchronized (lock) {
val field = 20; //Shadowing
val inner = 10;
switch (field) {
case 5:
val shouldBeCharArray2 = shouldBeCharArray;
val innerInner = inner;
}
}
val shouldBeString = field; //Unshadowing
}
}
|