blob: 0f2afb2ac27eb6252781709ffe98ac3efad3fac9 (
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.var;
public class VarComplex {
private String field = "";
private static final int CONSTANT = 20;
public void testComplex() {
var shouldBeCharArray = field.toCharArray();
var shouldBeInt = CONSTANT;
var lock = new Object();
synchronized (lock) {
var field = 20; //Shadowing
var inner = 10;
switch (field) {
case 5:
var shouldBeCharArray2 = shouldBeCharArray;
var innerInner = inner;
}
}
var shouldBeString = field; //Unshadowing
}
}
|