langtools/test/tools/javac/scope/DupUnsharedTest.java
changeset 29776 984a79b71cfe
parent 27553 75321debd020
child 30730 d3ce7619db2c
equal deleted inserted replaced
29775:dc7df633fea1 29776:984a79b71cfe
     1 /*
     1 /*
     2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    66         if (errors > 0)
    66         if (errors > 0)
    67             throw new AssertionError("Errors detected (" + errors + ").");
    67             throw new AssertionError("Errors detected (" + errors + ").");
    68     }
    68     }
    69 
    69 
    70     void runScopeContentTest() throws Exception {
    70     void runScopeContentTest() throws Exception {
    71         Set<Symbol> expected = Collections.newSetFromMap(new IdentityHashMap<>());
    71         Set<Symbol> expected = Collections.newSetFromMap(new IdentityHashMap<>() {});
    72         Set<Symbol> notExpected = Collections.newSetFromMap(new IdentityHashMap<>());
    72         Set<Symbol> notExpected = Collections.newSetFromMap(new IdentityHashMap<>());
    73         WriteableScope s1 = WriteableScope.create(symtab.rootPackage);
    73         WriteableScope s1 = WriteableScope.create(symtab.rootPackage);
    74         ClassSymbol acceptSym = symtab.arrayClass;
    74         ClassSymbol acceptSym = symtab.arrayClass;
    75         s1.enter(acceptSym);
    75         s1.enter(acceptSym);
    76         expected.add(acceptSym);
    76         expected.add(acceptSym);
   103         notExpected.add(var1);
   103         notExpected.add(var1);
   104         notExpected.add(var2);
   104         notExpected.add(var2);
   105     }
   105     }
   106 
   106 
   107     Set<Symbol> toSet(Iterable<Symbol> it) {
   107     Set<Symbol> toSet(Iterable<Symbol> it) {
   108         Set<Symbol> result = Collections.newSetFromMap(new IdentityHashMap<>());
   108         Set<Symbol> result = Collections.newSetFromMap(new IdentityHashMap<>() {});
   109 
   109 
   110         for (Symbol sym : it) {
   110         for (Symbol sym : it) {
   111             result.add(sym);
   111             result.add(sym);
   112         }
   112         }
   113 
   113