changeset 3118:09b36c8c6bce

Merge
author ihse
date Thu, 11 Jun 2015 00:50:51 +0200
parents 404f1956145b c71857c93f57
children 89ba2a17ce41
files test/tools/javac/7153958/pkg/ClassToBeStaticallyImported.java
diffstat 25 files changed, 652 insertions(+), 129 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jun 11 00:23:18 2015 +0200
+++ b/.hgtags	Thu Jun 11 00:50:51 2015 +0200
@@ -309,3 +309,4 @@
 809d66512998789b620d08c335d7c31211a0cf29 jdk9-b64
 4fcf722b811406a7db8f206d88446c82cda1b5f4 jdk9-b65
 fd6bda430d96fc5ab421161de016412f2ddd9082 jdk9-b66
+fd782cd69b0497299269952d30a6b88cad960fcf jdk9-b67
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Thu Jun 11 00:50:51 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -407,12 +407,11 @@
             }
         }
 
-        /** Remove symbol from this scope.  Used when an inner class
-         *  attribute tells us that the class isn't a package member.
+        /** Remove symbol from this scope.
          */
         public void remove(Symbol sym) {
             Assert.check(shared == 0);
-            Entry e = lookup(sym.name);
+            Entry e = lookup(sym.name, candidate -> candidate == sym);
             if (e.scope == null) return;
 
             // remove e from table and shadowed list;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jun 11 00:50:51 2015 +0200
@@ -2659,73 +2659,92 @@
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="compute transitive closure of all members in given site">
-    class MembersClosureCache extends SimpleVisitor<CompoundScope, Boolean> {
-
-        private WeakHashMap<TypeSymbol, Entry> _map = new WeakHashMap<>();
-
-        class Entry {
-            final boolean skipInterfaces;
-            final CompoundScope compoundScope;
-
-            public Entry(boolean skipInterfaces, CompoundScope compoundScope) {
-                this.skipInterfaces = skipInterfaces;
-                this.compoundScope = compoundScope;
+    class MembersClosureCache extends SimpleVisitor<Scope.CompoundScope, Void> {
+
+        private Map<TypeSymbol, CompoundScope> _map = new HashMap<>();
+
+        Set<TypeSymbol> seenTypes = new HashSet<>();
+
+        class MembersScope extends CompoundScope {
+
+            CompoundScope scope;
+
+            public MembersScope(CompoundScope scope) {
+                super(scope.owner);
+                this.scope = scope;
             }
 
-            boolean matches(boolean skipInterfaces) {
-                return this.skipInterfaces == skipInterfaces;
+            Filter<Symbol> combine(Filter<Symbol> sf) {
+                return s -> !s.owner.isInterface() && (sf == null || sf.accepts(s));
+            }
+
+            @Override
+            public Iterable<Symbol> getSymbols(Filter<Symbol> sf, LookupKind lookupKind) {
+                return scope.getSymbols(combine(sf), lookupKind);
+            }
+
+            @Override
+            public Iterable<Symbol> getSymbolsByName(Name name, Filter<Symbol> sf, LookupKind lookupKind) {
+                return scope.getSymbolsByName(name, combine(sf), lookupKind);
+            }
+
+            @Override
+            public int getMark() {
+                return scope.getMark();
             }
         }
 
-        List<TypeSymbol> seenTypes = List.nil();
+        CompoundScope nilScope;
 
         /** members closure visitor methods **/
 
-        public CompoundScope visitType(Type t, Boolean skipInterface) {
-            return null;
+        public CompoundScope visitType(Type t, Void _unused) {
+            if (nilScope == null) {
+                nilScope = new CompoundScope(syms.noSymbol);
+            }
+            return nilScope;
         }
 
         @Override
-        public CompoundScope visitClassType(ClassType t, Boolean skipInterface) {
-            if (seenTypes.contains(t.tsym)) {
+        public CompoundScope visitClassType(ClassType t, Void _unused) {
+            if (!seenTypes.add(t.tsym)) {
                 //this is possible when an interface is implemented in multiple
-                //superclasses, or when a classs hierarchy is circular - in such
+                //superclasses, or when a class hierarchy is circular - in such
                 //cases we don't need to recurse (empty scope is returned)
                 return new CompoundScope(t.tsym);
             }
             try {
-                seenTypes = seenTypes.prepend(t.tsym);
+                seenTypes.add(t.tsym);
                 ClassSymbol csym = (ClassSymbol)t.tsym;
-                Entry e = _map.get(csym);
-                if (e == null || !e.matches(skipInterface)) {
-                    CompoundScope membersClosure = new CompoundScope(csym);
-                    if (!skipInterface) {
-                        for (Type i : interfaces(t)) {
-                            membersClosure.prependSubScope(visit(i, skipInterface));
-                        }
+                CompoundScope membersClosure = _map.get(csym);
+                if (membersClosure == null) {
+                    membersClosure = new CompoundScope(csym);
+                    for (Type i : interfaces(t)) {
+                        membersClosure.prependSubScope(visit(i, null));
                     }
-                    membersClosure.prependSubScope(visit(supertype(t), skipInterface));
+                    membersClosure.prependSubScope(visit(supertype(t), null));
                     membersClosure.prependSubScope(csym.members());
-                    e = new Entry(skipInterface, membersClosure);
-                    _map.put(csym, e);
+                    _map.put(csym, membersClosure);
                 }
-                return e.compoundScope;
+                return membersClosure;
             }
             finally {
-                seenTypes = seenTypes.tail;
+                seenTypes.remove(t.tsym);
             }
         }
 
         @Override
-        public CompoundScope visitTypeVar(TypeVar t, Boolean skipInterface) {
-            return visit(t.getUpperBound(), skipInterface);
+        public CompoundScope visitTypeVar(TypeVar t, Void _unused) {
+            return visit(t.getUpperBound(), null);
         }
     }
 
     private MembersClosureCache membersCache = new MembersClosureCache();
 
     public CompoundScope membersClosure(Type site, boolean skipInterface) {
-        return membersCache.visit(site, skipInterface);
+        CompoundScope cs = membersCache.visit(site, null);
+        Assert.checkNonNull(cs, () -> "type " + site);
+        return skipInterface ? membersCache.new MembersScope(cs) : cs;
     }
     // </editor-fold>
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Jun 11 00:50:51 2015 +0200
@@ -2270,6 +2270,7 @@
             final Bits prevUninits = new Bits(uninits);
             final Bits prevInits = new Bits(inits);
             int returnadrPrev = returnadr;
+            int nextadrPrev = nextadr;
             ListBuffer<AssignPendingExit> prevPending = pendingExits;
             try {
                 returnadr = nextadr;
@@ -2291,6 +2292,7 @@
                 uninits.assign(prevUninits);
                 inits.assign(prevInits);
                 pendingExits = prevPending;
+                nextadr = nextadrPrev;
             }
         }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jun 11 00:50:51 2015 +0200
@@ -3185,10 +3185,8 @@
                 findDiamond(env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()) :
                 findMethod(env, site, name, argtypes, typeargtypes,
                         phase.isBoxingRequired(), phase.isVarargsRequired());
-            return (sym.kind != MTH ||
-                    site.getEnclosingType().hasTag(NONE) ||
-                    hasEnclosingInstance(env, site)) ?
-                    sym : new BadConstructorReferenceError(sym);
+            return site.getEnclosingType().hasTag(CLASS) && !hasEnclosingInstance(env, site) ?
+                        new BadConstructorReferenceError(sym) : sym;
         }
 
         @Override
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Jun 11 00:50:51 2015 +0200
@@ -470,6 +470,10 @@
                         clinitTAs.addAll(getAndRemoveNonFieldTAs(sym));
                     } else {
                         checkStringConstant(vdef.init.pos(), sym.getConstValue());
+                        /* if the init contains a reference to an external class, add it to the
+                         * constant's pool
+                         */
+                        vdef.init.accept(classReferenceVisitor);
                     }
                 }
                 break;
@@ -2337,9 +2341,11 @@
             ClassSymbol c = cdef.sym;
             this.toplevel = env.toplevel;
             this.endPosTable = toplevel.endPositions;
-            cdef.defs = normalizeDefs(cdef.defs, c);
             c.pool = pool;
             pool.reset();
+            /* method normalizeDefs() can add references to external classes into the constant pool
+             */
+            cdef.defs = normalizeDefs(cdef.defs, c);
             generateReferencesToPrunedTree(c, pool);
             Env<GenContext> localEnv = new Env<>(cdef, new GenContext());
             localEnv.toplevel = env.toplevel;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/ProblemList.txt	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,26 @@
+###########################################################################
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+###########################################################################
+
+# No langtools tests are on the problem list.
--- a/test/TEST.ROOT	Thu Jun 11 00:23:18 2015 +0200
+++ b/test/TEST.ROOT	Thu Jun 11 00:50:51 2015 +0200
@@ -1,6 +1,18 @@
 # This file identifies the root of the test-suite hierarchy.
 # It also contains test-suite configuration information.
-# DO NOT EDIT without first contacting jdk-regtest@sun.com.
 
-# The list of keywords supported in the entire test suite
-keys=2d dnd i18n
+# The list of keywords supported in the entire test suite.  The
+# "intermittent" keyword marks tests known to fail intermittently.
+# The "randomness" keyword marks tests using randomness with test
+# cases differing from run to run. (A test using a fixed random seed
+# would not count as "randomness" by this definition.) Extra care
+# should be taken to handle test failures of intermittent or
+# randomness tests.
+
+keys=intermittent randomness
+
+# Group definitions
+groups=TEST.groups
+
+# Tests using jtreg 4.1 b11 features
+requiredVersion=4.1 b11
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/TEST.groups	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,32 @@
+#  Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+#  This code is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License version 2 only, as
+#  published by the Free Software Foundation.
+#
+#  This code is distributed in the hope that it will be useful, but WITHOUT
+#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#  version 2 for more details (a copy is included in the LICENSE file that
+#  accompanied this code).
+#
+#  You should have received a copy of the GNU General Public License version
+#  2 along with this work; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+#  or visit www.oracle.com if you need additional information or have any
+#  questions.
+#
+
+# Tiered testing definitions
+
+# All langtools tests are tier 1
+tier1 = \
+    tools \
+    com \
+    lib
+
+# No langtools tests are tier 2
+tier2 = 
--- a/test/tools/javac/4846262/CheckEBCDICLocaleTest.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/test/tools/javac/4846262/CheckEBCDICLocaleTest.java	Thu Jun 11 00:50:51 2015 +0200
@@ -34,9 +34,12 @@
  */
 
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.PrintWriter;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
@@ -68,16 +71,19 @@
         tb.writeFile("Test.java", TestSrc);
         tb.createDirectories("output");
 
-        Native2Ascii n2a = new Native2Ascii(Charset.forName("IBM1047"));
+        Charset ebcdic = Charset.forName("IBM1047");
+        Native2Ascii n2a = new Native2Ascii(ebcdic);
         n2a.asciiToNative(Paths.get("Test.java"), Paths.get("output", "Test.java"));
 
-        tb.new JavacTask(ToolBox.Mode.EXEC)
-                .redirect(ToolBox.OutputKind.STDERR, "Test.tmp")
-                .options("-J-Duser.language=en",
-                        "-J-Duser.region=US",
-                        "-J-Dfile.encoding=IBM1047")
-                .files("output/Test.java")
-                .run(ToolBox.Expect.FAIL);
+        // Use -encoding to specify the encoding with which to read source files
+        // Use a suitable configured output stream for javac diagnostics
+        int rc;
+        try (PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("Test.tmp"), ebcdic))) {
+            String[] args = { "-encoding", ebcdic.name(), "output/Test.java" };
+            rc = com.sun.tools.javac.Main.compile(args, out);
+            if (rc != 1)
+                throw new Exception("unexpected exit from javac: " + rc);
+        }
 
         n2a.nativeToAscii(Paths.get("Test.tmp"), Paths.get("Test.out"));
 
@@ -87,16 +93,21 @@
         try {
             tb.checkEqual(expectLines, actualLines);
         } catch (Throwable tt) {
-            System.err.println("current ouput don't have the expected number of lines. See output below");
+            PrintStream out = tb.out;
+            out.println("Output mismatch:");
 
-            System.err.println("Expected output:");
-            System.err.println(TestOutTemplate);
-            System.err.println();
-            System.err.println("Actual output:");
+            out.println("Expected output:");
+            for (String s: expectLines) {
+                out.println(s);
+            }
+            out.println();
+
+            out.println("Actual output:");
             for (String s : actualLines) {
-                System.err.println(s);
+                out.println(s);
             }
-            System.err.println();
+            out.println();
+
             throw tt;
         }
     }
--- a/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java	Thu Jun 11 00:50:51 2015 +0200
@@ -25,10 +25,10 @@
 
 /*
  * @test
- * @bug 7153958
+ * @bug 7153958 8073372
  * @summary add constant pool reference to class containing inlined constants
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @compile pkg/ClassToBeStaticallyImported.java CPoolRefClassContainingInlinedCts.java
+ * @compile pkg/ClassToBeStaticallyImportedA.java pkg/ClassToBeStaticallyImportedB.java CPoolRefClassContainingInlinedCts.java
  * @run main CPoolRefClassContainingInlinedCts
  */
 
@@ -39,7 +39,8 @@
 import java.io.File;
 import java.io.IOException;
 
-import static pkg.ClassToBeStaticallyImported.staticField;
+import static pkg.ClassToBeStaticallyImportedA.staticFieldA;
+import static pkg.ClassToBeStaticallyImportedB.staticFieldB;
 
 public class CPoolRefClassContainingInlinedCts {
 
@@ -55,10 +56,14 @@
 
     void checkClassName(String className) {
         switch (className) {
-            case "SimpleAssignClass" : case "BinaryExpClass":
-            case "UnaryExpClass" : case "CastClass":
-            case "ParensClass" : case "CondClass":
-            case "IfClass" : case "pkg/ClassToBeStaticallyImported":
+            case "SimpleAssignClassA" : case "BinaryExpClassA":
+            case "UnaryExpClassA" : case "CastClassA":
+            case "ParensClassA" : case "CondClassA":
+            case "IfClassA" : case "pkg/ClassToBeStaticallyImportedA":
+            case "SimpleAssignClassB" : case "BinaryExpClassB":
+            case "UnaryExpClassB" : case "CastClassB":
+            case "ParensClassB" : case "CondClassB":
+            case "IfClassB" : case "pkg/ClassToBeStaticallyImportedB":
                 numberOfReferencedClassesToBeChecked++;
         }
     }
@@ -77,59 +82,111 @@
             }
             i += cpInfo.size();
         }
-        if (numberOfReferencedClassesToBeChecked != 8) {
+        if (numberOfReferencedClassesToBeChecked != 16) {
             throw new AssertionError("Class reference missing in the constant pool");
         }
     }
 
-    private int assign = SimpleAssignClass.x;
-    private int binary = BinaryExpClass.x + 1;
-    private int unary = -UnaryExpClass.x;
-    private int cast = (int)CastClass.x;
-    private int parens = (ParensClass.x);
-    private int cond = (CondClass.x == 1) ? 1 : 2;
-    private static int ifConstant;
-    private static int importStatic;
+    private int assignA = SimpleAssignClassA.x;
+    private int binaryA = BinaryExpClassA.x + 1;
+    private int unaryA = -UnaryExpClassA.x;
+    private int castA = (int)CastClassA.x;
+    private int parensA = (ParensClassA.x);
+    private int condA = (CondClassA.x == 1) ? 1 : 2;
+    private static int ifConstantA;
+    private static int importStaticA;
     static {
-        if (IfClass.x == 1) {
-            ifConstant = 1;
+        if (IfClassA.x == 1) {
+            ifConstantA = 1;
         } else {
-            ifConstant = 2;
+            ifConstantA = 2;
         }
     }
     static {
-        if (staticField == 1) {
-            importStatic = 1;
+        if (staticFieldA == 1) {
+            importStaticA = 1;
         } else {
-            importStatic = 2;
+            importStaticA = 2;
+        }
+    }
+
+    // now as final constants
+    private static final int assignB = SimpleAssignClassB.x;
+    private static final int binaryB = BinaryExpClassB.x + 1;
+    private static final int unaryB = -UnaryExpClassB.x;
+    private static final int castB = (int)CastClassB.x;
+    private static final int parensB = (ParensClassB.x);
+    private static final int condB = (CondClassB.x == 1) ? 1 : 2;
+    private static final int ifConstantB;
+    private static final int importStaticB;
+    static {
+        if (IfClassB.x == 1) {
+            ifConstantB = 1;
+        } else {
+            ifConstantB = 2;
+        }
+    }
+    static {
+        if (staticFieldB == 1) {
+            importStaticB = 1;
+        } else {
+            importStaticB = 2;
         }
     }
 }
 
-class SimpleAssignClass {
+class SimpleAssignClassA {
     public static final int x = 1;
 }
 
-class BinaryExpClass {
+class SimpleAssignClassB {
     public static final int x = 1;
 }
 
-class UnaryExpClass {
+class BinaryExpClassA {
     public static final int x = 1;
 }
 
-class CastClass {
+class BinaryExpClassB {
     public static final int x = 1;
 }
 
-class ParensClass {
+class UnaryExpClassA {
     public static final int x = 1;
 }
 
-class CondClass {
+class UnaryExpClassB {
     public static final int x = 1;
 }
 
-class IfClass {
+class CastClassA {
     public static final int x = 1;
 }
+
+class CastClassB {
+    public static final int x = 1;
+}
+
+class ParensClassA {
+    public static final int x = 1;
+}
+
+class ParensClassB {
+    public static final int x = 1;
+}
+
+class CondClassA {
+    public static final int x = 1;
+}
+
+class CondClassB {
+    public static final int x = 1;
+}
+
+class IfClassA {
+    public static final int x = 1;
+}
+
+class IfClassB {
+    public static final int x = 1;
+}
--- a/test/tools/javac/7153958/pkg/ClassToBeStaticallyImported.java	Thu Jun 11 00:23:18 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package pkg;
-
-public class ClassToBeStaticallyImported {
-    public static final int staticField = 1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7153958/pkg/ClassToBeStaticallyImportedA.java	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package pkg;
+
+public class ClassToBeStaticallyImportedA {
+    public static final int staticFieldA = 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7153958/pkg/ClassToBeStaticallyImportedB.java	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package pkg;
+
+public class ClassToBeStaticallyImportedB {
+    public static final int staticFieldB = 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaParameterNeedsNoInitTest.java	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8077667
+ * @summary Eliminate bogus error about lambda parameter not being initialized.
+ * @compile LambdaParameterNeedsNoInitTest.java
+ */
+import java.util.function.Predicate;
+
+public class LambdaParameterNeedsNoInitTest {
+
+    public static void main(String[] args) {
+        new Inner();
+    }
+
+    private static class Inner {
+        Predicate<String> synonymComparator = a -> a.isEmpty();
+        Inner() {
+            if (true) {
+                return;
+            }
+            synonymComparator.test("");
+        }
+    }
+}
--- a/test/tools/javac/lambda/MethodReference23.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/test/tools/javac/lambda/MethodReference23.java	Thu Jun 11 00:50:51 2015 +0200
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8003280 8075184
+ * @bug 8003280 8075184 8081271
  * @summary Add lambda tests
  *  check that pair of bound/non-bound constructor references is flagged as ambiguous
  * @author  Maurizio Cimadamore
@@ -49,8 +49,8 @@
     static void call3(SAM22 s) {   }
 
     static void test11() {
-        SAM11 s = MethodReference23.Inner1::new; //ok
-        call11(MethodReference23.Inner1::new); //ok
+        SAM11 s = MethodReference23.Inner1::new; // fail.
+        call11(MethodReference23.Inner1::new); // fail.
     }
 
     static void test12() {
--- a/test/tools/javac/lambda/MethodReference23.out	Thu Jun 11 00:23:18 2015 +0200
+++ b/test/tools/javac/lambda/MethodReference23.out	Thu Jun 11 00:50:51 2015 +0200
@@ -1,5 +1,5 @@
 MethodReference23.java:52:19: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23)
-MethodReference23.java:53:16: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23)
+MethodReference23.java:53:16: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23)
 MethodReference23.java:57:19: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23)
 MethodReference23.java:58:16: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23)
 MethodReference23.java:72:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference23.SAM21), MethodReference23, kindname.method, call3(MethodReference23.SAM22), MethodReference23
--- a/test/tools/javac/lambda/MethodReference37.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/test/tools/javac/lambda/MethodReference37.java	Thu Jun 11 00:50:51 2015 +0200
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8003280
+ * @bug 8003280 8081271
  * @summary Add lambda tests
  *  spurious exceptions when checking references to inner constructors where
  *          the enclosing class is not defined in any outer context
@@ -20,7 +20,7 @@
     static class Outer {
         class Inner { }
 
-        static void test1() {
+        void test1() {
             SAM2<Inner, Outer> sam = Inner::new;
         }
 
--- a/test/tools/javac/lambda/MethodReference37.out	Thu Jun 11 00:23:18 2015 +0200
+++ b/test/tools/javac/lambda/MethodReference37.out	Thu Jun 11 00:50:51 2015 +0200
@@ -1,5 +1,5 @@
 MethodReference37.java:24:38: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Inner, compiler.misc.no.args, MethodReference37.Outer, kindname.class, MethodReference37.Outer.Inner, (compiler.misc.arg.length.mismatch)))
 MethodReference37.java:29:39: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Inner, compiler.misc.no.args, MethodReference37.Outer, kindname.class, MethodReference37.Outer.Inner, (compiler.misc.arg.length.mismatch)))
-MethodReference37.java:34:40: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Inner, compiler.misc.no.args, MethodReference37.Outer, kindname.class, MethodReference37.Outer.Inner, (compiler.misc.arg.length.mismatch)))
-MethodReference37.java:38:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Inner, compiler.misc.no.args, MethodReference37.Outer, kindname.class, MethodReference37.Outer.Inner, (compiler.misc.arg.length.mismatch)))
+MethodReference37.java:34:40: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner, MethodReference37.Outer, MethodReference37.Outer)
+MethodReference37.java:38:41: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner, MethodReference37.Outer, MethodReference37.Outer)
 4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/methodReference/MethodRefToInnerWithoutOuter.java	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,24 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8081271
+ * @summary NPE while compiling a program with erroneous use of constructor reference expressions.
+ * @compile/fail/ref=MethodRefToInnerWithoutOuter.out -XDrawDiagnostics MethodRefToInnerWithoutOuter.java
+*/
+
+import java.util.List;
+import java.util.ArrayList;
+
+class MethodRefToInnerBase {
+    class TestString {
+        String str;
+        TestString(String strin) {
+            str = strin;
+        }
+    }
+}
+public class MethodRefToInnerWithoutOuter extends MethodRefToInnerBase {
+    public static void main(String[] args) {
+        List<String> list = new ArrayList<>();
+        list.stream().forEach(TestString::new);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/methodReference/MethodRefToInnerWithoutOuter.out	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,2 @@
+MethodRefToInnerWithoutOuter.java:22:31: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: TestString, , MethodRefToInnerBase)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/scope/RemoveSymbolTest.java	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8080842
+ * @summary Ensure Scope impl can cope with remove() when a field and method share the name.
+ * @run main RemoveSymbolTest
+ */
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class RemoveSymbolTest<W> implements Iterable<W> {
+    static class Widget {
+        private String name;
+        Widget(String s) { name = s; }
+        @Override public String toString() { return name; }
+    }
+
+    private LinkedList<W> data;
+    // Instantiate an Iterable instance using a Lambda expression.
+    // Causes ClassFormatError if a local variable of type Widget is named after one of the methods.
+    private final Iterable<W> myIterator1 = () -> new Iterator<W>() {
+        private W hasNext = null;
+        private int index = 0;
+        @Override public boolean hasNext() { return index < data.size(); }
+        @Override public W next() { return data.get(index++); }
+    };
+
+    // Instantiate an Iterable instance using an anonymous class.
+    // Always works fine regardless of the name of the local variable.
+    private final Iterable<W> myIterator2 =
+        new Iterable<W>() {
+        @Override
+        public Iterator<W> iterator() {
+            return new Iterator<W>() {
+                private W hasNext = null;
+                private int index = 0;
+                @Override public boolean hasNext() { return index < data.size(); }
+                @Override public W next() { return data.get(index++); }
+            };
+        }
+    };
+    public RemoveSymbolTest() { data = new LinkedList<>(); }
+    public void add(W e) { data.add(e); }
+    @Override public String toString() { return data.toString(); }
+    @Override public Iterator<W> iterator() { return myIterator1.iterator(); }
+    public static void main(String[] args) {
+        RemoveSymbolTest<Widget> widgets = new RemoveSymbolTest<>();
+        widgets.add(new Widget("W1"));
+        widgets.add(new Widget("W2"));
+        widgets.add(new Widget("W3"));
+        System.out.println(".foreach() call: ");
+        widgets.forEach(w -> System.out.println(w + " "));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/scope/RemoveSymbolUnitTest.java	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8080842
+ * @summary Ensure Scope impl can cope with remove() when a field and method share the name.
+ * @modules jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.util
+ */
+
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Scope.*;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.file.JavacFileManager;
+
+public class RemoveSymbolUnitTest {
+
+    Context context;
+    Names names;
+    Symtab symtab;
+
+    public static void main(String... args) throws Exception {
+        new RemoveSymbolUnitTest().run();
+    }
+
+    public void run() {
+        context = new Context();
+        JavacFileManager.preRegister(context); // required by ClassReader which is required by Symtab
+        names = Names.instance(context);
+        symtab = Symtab.instance(context);
+
+        Name hasNext =  names.fromString("hasNext");
+        ClassSymbol clazz = new ClassSymbol(0,
+                                            names.fromString("X"),
+                                            Type.noType,
+                                            symtab.unnamedPackage);
+
+        VarSymbol v = new VarSymbol(0, hasNext, Type.noType, clazz);
+        MethodSymbol m = new MethodSymbol(0, hasNext, Type.noType, clazz);
+
+        // Try enter and remove in different shuffled combinations.
+        // working with fresh scope each time.
+        WriteableScope cs = WriteableScope.create(clazz);
+        cs.enter(v);
+        cs.enter(m);
+        cs.remove(v);
+        Symbol s = cs.findFirst(hasNext);
+        if (s != m)
+            throw new AssertionError("Wrong symbol");
+
+        cs = WriteableScope.create(clazz);
+        cs.enter(m);
+        cs.enter(v);
+        cs.remove(v);
+        s = cs.findFirst(hasNext);
+        if (s != m)
+            throw new AssertionError("Wrong symbol");
+
+        cs = WriteableScope.create(clazz);
+        cs.enter(v);
+        cs.enter(m);
+        cs.remove(m);
+        s = cs.findFirst(hasNext);
+        if (s != v)
+            throw new AssertionError("Wrong symbol");
+
+        cs = WriteableScope.create(clazz);
+        cs.enter(m);
+        cs.enter(v);
+        cs.remove(m);
+        s = cs.findFirst(hasNext);
+        if (s != v)
+            throw new AssertionError("Wrong symbol");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/types/ScopeListenerTest.java	Thu Jun 11 00:50:51 2015 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8039262
+ * @summary Ensure that using Types.membersClosure does not increase the number of listeners on the
+ *          class's members Scope.
+ */
+
+import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Names;
+import java.lang.reflect.Field;
+import java.util.Collection;
+
+public class ScopeListenerTest {
+
+    public static void main(String[] args) throws Exception {
+        new ScopeListenerTest().run();
+    }
+
+    void run() throws Exception {
+        Context context = new Context();
+        JavacFileManager.preRegister(context);
+        Types types = Types.instance(context);
+        Symtab syms = Symtab.instance(context);
+        Names names = Names.instance(context);
+        types.membersClosure(syms.stringType, true);
+        types.membersClosure(syms.stringType, false);
+
+        Field listenersField = Scope.class.getDeclaredField("listeners");
+
+        listenersField.setAccessible(true);
+
+        int listenerCount =
+                ((Collection) listenersField.get(syms.stringType.tsym.members())).size();
+
+        for (int i = 0; i < 100; i++) {
+            types.membersClosure(syms.stringType, true);
+            types.membersClosure(syms.stringType, false);
+        }
+
+        int newListenerCount
+                = ((Collection) listenersField.get(syms.stringType.tsym.members())).size();
+
+        if (listenerCount != newListenerCount) {
+            throw new AssertionError("Orig listener count: " + listenerCount +
+                                     "; new listener count: " + newListenerCount);
+        }
+
+        for (Symbol s : types.membersClosure(syms.stringType, true).getSymbols())
+            ;
+        for (Symbol s : types.membersClosure(syms.stringType, false).getSymbolsByName(names.fromString("substring")))
+            ;
+    }
+
+}
--- a/test/tools/javadoc/api/basic/GetTask_DocletClassTest.java	Thu Jun 11 00:23:18 2015 +0200
+++ b/test/tools/javadoc/api/basic/GetTask_DocletClassTest.java	Thu Jun 11 00:50:51 2015 +0200
@@ -28,6 +28,7 @@
  * @modules jdk.javadoc
  * @build APITest
  * @run main GetTask_DocletClassTest
+ * @key randomness
  */
 
 import com.sun.javadoc.DocErrorReporter;