use lambda to avoid context remapping (IDEA-185448)

for anonymous class this expressions have to be encoded to point to outer class, for lambda expressions there is no need for that. Leave unchanged (array initializer) for old java versions
This commit is contained in:
Anna Kozlova
2018-01-30 19:38:53 +03:00
parent d8f37a3ea8
commit f1536bb969
3 changed files with 35 additions and 14 deletions
@@ -0,0 +1,11 @@
import java.util.*;
class Test {
private final Collection<Integer> collection = new ArrayList<>();
{
List<Integer> l = Collections.unmodifiableList((List<Integer>)this.collection);
System.out.println(l);
}
}