Double curly brackets initialization in Java 8

It doesn’t work. At least when used in JUnit tests, but I am sure the problem is not with JUnit.

public void test() {
Pattern p = new Pattern(new ArrayList()
{{ addAll(cl2); addAll(cl1); addAll(cl1); addAll(cl2); }});

private ArrayList<LinkedHashSet> fieldTable = new ArrayList();
    private LinkedHashSet bindings = new LinkedHashSet();
    public Pattern(List allBindings) {
        fieldTable = new ArrayList();     
        fieldTable.add(new LinkedHashSet());
        fieldTable.add(new LinkedHashSet());
        fieldTable.add(new LinkedHashSet());

The static constructor represented by the double curly brackets will cause a java.lang.exceptionininitializererror .
The more usual variant where a new ArrayList is created separately and then filled using addAll() works fine.

I solved the problem by installing JDK1.7, adding the platform to netbeans from Tools > Java Platforms and then going to project > right click > properties > here set the JDK7 in library and sources format.

Usefull links:
Curly brackets initialization explained.

Java8 and curly brackets