Merge
authorduke
Wed, 05 Jul 2017 22:14:23 +0200
changeset 41034 f1a27e852c25
parent 41033 49af2ecba616 (diff)
parent 41026 a47b3f11f995 (current diff)
child 41035 9cb87c88ed85
Merge
hotspot/src/share/vm/gc/g1/g1Predictions.cpp
hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.cpp
hotspot/src/share/vm/gc/shared/referencePendingListLocker.cpp
hotspot/src/share/vm/gc/shared/referencePendingListLocker.hpp
hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java
hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
jdk/test/sun/security/pkcs11/nss/lib/windows-amd64/libnspr4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-amd64/libnspr4.lib
jdk/test/sun/security/pkcs11/nss/lib/windows-amd64/libplc4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-amd64/libplc4.lib
jdk/test/sun/security/pkcs11/nss/lib/windows-amd64/libplds4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-amd64/libplds4.lib
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libnspr4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libnspr4.lib
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libplc4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libplc4.lib
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libplds4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libplds4.lib
jdk/test/sun/security/pkcs11/nss/src/nss-3.16_nspr-4.10_src.tar.gz
jdk/test/sun/security/pkcs11/nss/src/nss-3.16_nspr-4.10_src.tar.gz.sha256
--- a/langtools/.hgtags	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/.hgtags	Wed Jul 05 22:14:23 2017 +0200
@@ -378,3 +378,4 @@
 7efa4b3477b2b93edbdb4abf827b74c6391f056e jdk-9+133
 f08683786207a48b652266b3b7b908e6c863c3fc jdk-9+134
 af5eb8f3ffd21288305a54ea177ffad75021a741 jdk-9+135
+c8f02f0ecbd7cd6700f47416e4b7e9d5ec20ad77 jdk-9+136
--- a/langtools/make/tools/crules/MutableFieldsAnalyzer.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/make/tools/crules/MutableFieldsAnalyzer.java	Wed Jul 05 22:14:23 2017 +0200
@@ -105,12 +105,12 @@
                 "configurationClass", "resolveRequiresAndUsesMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$Layer",
                 "layerClass", "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod");
+        ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$Module",
+                "addExportsMethod", "addUsesMethod", "getModuleMethod", "getUnnamedModuleMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$ServiceLoaderHelper",
                 "loadMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$VMHelper",
                 "vmClass", "getRuntimeArgumentsMethod");
-        ignoreFields("com.sun.tools.javac.util.ModuleHelper",
-                "addExportsMethod", "getUnnamedModuleMethod", "getModuleMethod");
     }
 
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Jul 05 22:14:23 2017 +0200
@@ -92,6 +92,7 @@
 
     private final Attribute theUnfinishedDefaultValue;
     private final boolean allowRepeatedAnnos;
+    private final String sourceName;
 
     protected Annotate(Context context) {
         context.put(annotateKey, this);
@@ -114,6 +115,7 @@
 
         Source source = Source.instance(context);
         allowRepeatedAnnos = source.allowRepeatedAnnotations();
+        sourceName = source.name;
     }
 
     /** Semaphore to delay annotation processing */
@@ -322,7 +324,7 @@
 
             if (annotated.containsKey(a.type.tsym)) {
                 if (!allowRepeatedAnnos) {
-                    log.error(DiagnosticFlag.SOURCE_LEVEL, a.pos(), "repeatable.annotations.not.supported.in.source");
+                    log.error(DiagnosticFlag.SOURCE_LEVEL, a.pos(), "repeatable.annotations.not.supported.in.source", sourceName);
                 }
                 ListBuffer<T> l = annotated.get(a.type.tsym);
                 l = l.append(c);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jul 05 22:14:23 2017 +0200
@@ -2256,6 +2256,12 @@
                               types.erasure(owner.enclClass().asType()));
             }
 
+            boolean isProtectedInSuperClassOfEnclosingClassInOtherPackage() {
+                return ((tree.sym.flags() & PROTECTED) != 0 &&
+                        tree.sym.packge() != owner.packge() &&
+                        !owner.enclClass().isSubClass(tree.sym.owner, types));
+            }
+
             /**
              * Signature polymorphic methods need special handling.
              * e.g. MethodHandle.invoke() MethodHandle.invokeExact()
@@ -2293,6 +2299,7 @@
                         needsVarArgsConversion() ||
                         isArrayOp() ||
                         isPrivateInOtherClass() ||
+                        isProtectedInSuperClassOfEnclosingClassInOtherPackage() ||
                         !receiverAccessible() ||
                         (tree.getMode() == ReferenceMode.NEW &&
                           tree.kind != ReferenceKind.ARRAY_CTOR &&
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Wed Jul 05 22:14:23 2017 +0200
@@ -78,6 +78,7 @@
 import com.sun.tools.javac.util.JDK9Wrappers.Configuration;
 import com.sun.tools.javac.util.JDK9Wrappers.Layer;
 import com.sun.tools.javac.util.JDK9Wrappers.ModuleFinder;
+import com.sun.tools.javac.util.JDK9Wrappers.Module;
 import com.sun.tools.javac.util.JDK9Wrappers.ServiceLoaderHelper;
 
 import static java.nio.file.FileVisitOption.FOLLOW_LINKS;
@@ -957,6 +958,7 @@
     public <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) throws IOException {
         nullCheck(location);
         nullCheck(service);
+        Module.getModule(getClass()).addUses(service);
         if (location.isModuleLocation()) {
             Collection<Path> paths = locations.getLocation(location);
             ModuleFinder finder = ModuleFinder.of(paths.toArray(new Path[paths.size()]));
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jul 05 22:14:23 2017 +0200
@@ -1232,7 +1232,7 @@
             Chain exit = switchEnv.info.exit;
             if  (exit != null) {
                 code.resolve(exit);
-                exit.state.defined.excludeFrom(code.nextreg);
+                exit.state.defined.excludeFrom(limit);
             }
 
             // If we have not set the default offset, we do so now.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jul 05 22:14:23 2017 +0200
@@ -79,6 +79,7 @@
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Iterators;
 import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.util.JDK9Wrappers.Module;
 import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Log;
@@ -119,7 +120,6 @@
     private final JavacTypes typeUtils;
     private final JavaCompiler compiler;
     private final Modules modules;
-    private final ModuleHelper moduleHelper;
     private final Types types;
 
     /**
@@ -227,7 +227,6 @@
         enter = Enter.instance(context);
         initialCompleter = ClassFinder.instance(context).getCompleter();
         chk = Check.instance(context);
-        moduleHelper = ModuleHelper.instance(context);
         initProcessorLoader();
 
         defaultModule = source.allowModules() && options.isUnset("noModules")
@@ -265,7 +264,8 @@
                     ? fileManager.getClassLoader(ANNOTATION_PROCESSOR_PATH)
                     : fileManager.getClassLoader(CLASS_PATH);
 
-                moduleHelper.addExports(processorClassLoader);
+                if (options.isSet("accessInternalAPI"))
+                    ModuleHelper.addExports(Module.getModule(getClass()), Module.getUnnamedModule(processorClassLoader));
 
                 if (processorClassLoader != null && processorClassLoader instanceof Closeable) {
                     compiler.closeables = compiler.closeables.prepend((Closeable) processorClassLoader);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java	Wed Jul 05 22:14:23 2017 +0200
@@ -130,6 +130,85 @@
     }
 
     /**
+     * Wrapper class for java.lang.reflect.Module. To materialize a handle use the static factory
+     * methods Module#getModule(Class<?>) or Module#getUnnamedModule(ClassLoader).
+     */
+    public static class Module {
+
+        private final Object theRealModule;
+
+        private Module(Object module) {
+            this.theRealModule = module;
+            init();
+        }
+
+        public static Module getModule(Class<?> clazz) {
+            try {
+                init();
+                Object result = getModuleMethod.invoke(clazz, new Object[0]);
+                return new Module(result);
+            } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
+                    | SecurityException ex) {
+                throw new Abort(ex);
+            }
+        }
+
+        public static Module getUnnamedModule(ClassLoader classLoader) {
+            try {
+                init();
+                Object result = getUnnamedModuleMethod.invoke(classLoader, new Object[0]);
+                return new Module(result);
+            } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
+                    | SecurityException ex) {
+                throw new Abort(ex);
+            }
+        }
+
+        public Module addExports(String pn, Module other) {
+            try {
+                addExportsMethod.invoke(theRealModule, new Object[] { pn, other.theRealModule});
+            } catch (IllegalAccessException | InvocationTargetException ex) {
+                throw new Abort(ex);
+            }
+            return this;
+        }
+
+        public Module addUses(Class<?> st) {
+            try {
+                addUsesMethod.invoke(theRealModule, new Object[] { st });
+            } catch (IllegalAccessException | InvocationTargetException ex) {
+                throw new Abort(ex);
+            }
+            return this;
+        }
+
+        // -----------------------------------------------------------------------------------------
+        // on java.lang.reflect.Module
+        private static Method addExportsMethod = null;
+        // on java.lang.reflect.Module
+        private static Method addUsesMethod = null;
+        // on java.lang.Class
+        private static Method getModuleMethod;
+        // on java.lang.ClassLoader
+        private static Method getUnnamedModuleMethod;
+
+        private static void init() {
+            if (addExportsMethod == null) {
+                try {
+                    Class<?> moduleClass = Class.forName("java.lang.reflect.Module", false, null);
+                    addUsesMethod = moduleClass.getDeclaredMethod("addUses", new Class<?>[] { Class.class });
+                    addExportsMethod = moduleClass.getDeclaredMethod("addExports",
+                                                        new Class<?>[] { String.class, moduleClass });
+                    getModuleMethod = Class.class.getDeclaredMethod("getModule", new Class<?>[0]);
+                    getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule", new Class<?>[0]);
+                } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
+                    throw new Abort(ex);
+                }
+            }
+        }
+    }
+
+    /**
      * Wrapper class for java.lang.module.Configuration.
      */
     public static final class Configuration {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java	Wed Jul 05 22:14:23 2017 +0200
@@ -25,88 +25,30 @@
 
 package com.sun.tools.javac.util;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
+import com.sun.tools.javac.util.JDK9Wrappers.Module;
 
 public class ModuleHelper {
-    /** The context key for the module helper. */
-    protected static final Context.Key<ModuleHelper> moduleHelperKey = new Context.Key<>();
-
-    /** Get the JavaCompiler instance for this context. */
-    public static ModuleHelper instance(Context context) {
-        ModuleHelper instance = context.get(moduleHelperKey);
-        if (instance == null)
-            instance = new ModuleHelper(context);
-        return instance;
-    }
-
-    public ModuleHelper(Context context) {
-        context.put(moduleHelperKey, this);
-        Options options = Options.instance(context);
-        allowAccessToInternalAPI = options.isSet("accessInternalAPI");
-    }
-
-    final boolean allowAccessToInternalAPI;
 
-    private void exportPackageToModule(String packageName, Object target)
-            throws ClassNotFoundException, NoSuchMethodException, IllegalArgumentException,
-                   InvocationTargetException, IllegalAccessException {
-        if (addExportsMethod == null) {
-            Class<?> moduleClass = Class.forName("java.lang.reflect.Module");
-            addExportsMethod = moduleClass.getDeclaredMethod("addExports",
-                    new Class<?>[] { String.class, moduleClass });
-        }
-        addExportsMethod.invoke(from, new Object[] { packageName, target });
-    }
+    private static final String[] javacInternalPackages = new String[] {
+            "com.sun.tools.javac.api",
+            "com.sun.tools.javac.code",
+            "com.sun.tools.javac.comp",
+            "com.sun.tools.javac.file",
+            "com.sun.tools.javac.jvm",
+            "com.sun.tools.javac.main",
+            "com.sun.tools.javac.model",
+            "com.sun.tools.javac.parser",
+            "com.sun.tools.javac.platform",
+            "com.sun.tools.javac.processing",
+            "com.sun.tools.javac.tree",
+            "com.sun.tools.javac.util",
 
-    static final String[] javacInternalPackages = new String[] {
-        "com.sun.tools.javac.api",
-        "com.sun.tools.javac.code",
-        "com.sun.tools.javac.comp",
-        "com.sun.tools.javac.file",
-        "com.sun.tools.javac.jvm",
-        "com.sun.tools.javac.main",
-        "com.sun.tools.javac.model",
-        "com.sun.tools.javac.parser",
-        "com.sun.tools.javac.platform",
-        "com.sun.tools.javac.processing",
-        "com.sun.tools.javac.tree",
-        "com.sun.tools.javac.util",
-
-        "com.sun.tools.doclint",
+            "com.sun.tools.doclint",
     };
 
-    public void addExports(ClassLoader classLoader) {
-        try {
-            if (allowAccessToInternalAPI) {
-                if (from == null) {
-                    if (getModuleMethod == null) {
-                        getModuleMethod = Class.class.getDeclaredMethod("getModule", new Class<?>[0]);
-                    }
-                    from = getModuleMethod.invoke(getClass(), new Object[0]);
-                }
-                if (getUnnamedModuleMethod == null) {
-                    getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule", new Class<?>[0]);
-                }
-                Object target = getUnnamedModuleMethod.invoke(classLoader, new Object[0]);
-                for (String pack: javacInternalPackages) {
-                    exportPackageToModule(pack, target);
-                }
-            }
-        } catch (Exception e) {
-            // do nothing
+    public static void addExports(Module from, Module to) {
+        for (String pack: javacInternalPackages) {
+            from.addExports(pack, to);
         }
     }
-
-    // a module instance
-    private Object from = null;
-
-    // on java.lang.reflect.Module
-    private static Method addExportsMethod = null;
-
-    // on java.lang.ClassLoader
-    private static Method getUnnamedModuleMethod = null;
-
-    // on java.lang.Class
-    private static Method getModuleMethod = null;
-}
+}
\ No newline at end of file
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Wed Jul 05 22:14:23 2017 +0200
@@ -263,18 +263,18 @@
             if (ui.item.l !== noResult.l) {
                 var url = "";
                 if (ui.item.category === catModules) {
-                    url = "/" + ui.item.l + "-summary.html";
+                    url = ui.item.l + "-summary.html";
                 } else if (ui.item.category === catPackages) {
                     url = ui.item.l.replace(/\./g, '/') + "/package-summary.html";
                 } else if (ui.item.category === catTypes) {
                     if (ui.item.p === "<Unnamed>") {
-                        url = "/" + ui.item.l + ".html";
+                        url = ui.item.l + ".html";
                     } else {
                         url = ui.item.p.replace(/\./g, '/') + "/" + ui.item.l + ".html";
                     }
                 } else if (ui.item.category === catMembers) {
                     if (ui.item.p === "<Unnamed>") {
-                        url = "/" + ui.item.c + ".html" + "#";
+                        url = ui.item.c + ".html" + "#";
                     } else {
                         url = ui.item.p.replace(/\./g, '/') + "/" + ui.item.c + ".html" + "#";
                     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/SwitchExitStateTest.java	Wed Jul 05 22:14:23 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016, 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 8160699
+ * @summary Verify that having finished executing a switch statement live locals are exactly the same as it was upon entry of the switch.
+ * @run main SwitchExitStateTest
+ */
+
+public class SwitchExitStateTest {
+    public static void main(String[] args) throws Exception {
+        switch (0) {
+        case 0:
+            String a = "";
+            break;
+        default:
+            throw new Exception("Unknown ");
+        }
+
+        switch (0) {
+        case 0:
+            String b = "";
+            break;
+        default:
+            throw new Exception("Unknown ");
+        }
+    }
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java	Wed Jul 05 22:14:11 2017 +0200
+++ b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java	Wed Jul 05 22:14:23 2017 +0200
@@ -106,12 +106,12 @@
         // The following static fields are used for caches of information obtained
         // by reflective lookup, to avoid explicit references that are not available
         // when running javac on JDK 8.
-        ignore("com/sun/tools/javac/util/ModuleHelper",
-                "addExportsMethod", "getModuleMethod", "getUnnamedModuleMethod");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$Configuration",
                 "resolveRequiresAndUsesMethod", "configurationClass");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$Layer",
                 "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod", "layerClass");
+        ignore("com/sun/tools/javac/util/JDK9Wrappers$Module",
+                "addExportsMethod", "addUsesMethod", "getModuleMethod", "getUnnamedModuleMethod");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$ModuleFinder",
                 "moduleFinderClass", "ofMethod");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$ServiceLoaderHelper",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongVersion.java	Wed Jul 05 22:14:23 2017 +0200
@@ -0,0 +1,23 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8138822
+ * @summary test that only Java 8+ allows repeating annotations
+ * @compile WrongVersion.java
+ * @compile -Xlint:-options -source 8 WrongVersion.java
+ * @compile/fail/ref=WrongVersion7.out -XDrawDiagnostics -Xlint:-options -source 7 WrongVersion.java
+ * @compile/fail/ref=WrongVersion6.out -XDrawDiagnostics -Xlint:-options -source 6 WrongVersion.java
+ */
+import java.lang.annotation.Repeatable;
+
+@Ann(1) @Ann(2)
+class C {
+}
+
+@Repeatable(AnnContainer.class)
+@interface Ann {
+    int value();
+}
+
+@interface AnnContainer {
+    Ann[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongVersion6.out	Wed Jul 05 22:14:23 2017 +0200
@@ -0,0 +1,2 @@
+WrongVersion.java:12:9: compiler.err.repeatable.annotations.not.supported.in.source: 1.6
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/WrongVersion7.out	Wed Jul 05 22:14:23 2017 +0200
@@ -0,0 +1,2 @@
+WrongVersion.java:12:9: compiler.err.repeatable.annotations.not.supported.in.source: 1.7
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/methodReference/ProtectedInaccessibleMethodRefTest.java	Wed Jul 05 22:14:23 2017 +0200
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2016, 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 8138667
+ * @summary Verify that javac emits suitable accessors when a method reference mentions a protected method that would need an accessor
+ * @run main ProtectedInaccessibleMethodRefTest
+ */
+
+
+import pack.SuperClass;
+
+import java.util.concurrent.Callable;
+
+public final class ProtectedInaccessibleMethodRefTest extends SuperClass {
+
+    static String message = "NOT OK";
+
+    public void doTest() throws Exception {
+        new Callable<Void>() {
+            @Override
+            public Void call() throws Exception {
+                final Runnable r = ProtectedInaccessibleMethodRefTest.this::myDo;
+                r.run();
+                return null;
+            }
+        }.call();
+
+        new Callable<Void>() {
+            @Override
+            public Void call() throws Exception {
+                final Runnable r = ProtectedInaccessibleMethodRefTest::myStaticDo;
+                r.run();
+                return null;
+            }
+        }.call();
+    }
+
+    public void message(String s) {
+        message = s;
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ProtectedInaccessibleMethodRefTest().doTest();
+        if (!message.equals("OK!"))
+            throw new AssertionError("Unexpected output");
+        if (!sMessage.equals("OK!"))
+            throw new AssertionError("Unexpected output");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/methodReference/pack/SuperClass.java	Wed Jul 05 22:14:23 2017 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+package pack;
+
+public class SuperClass {
+
+    public static String sMessage = "Not OK";
+
+    protected final void myDo() {
+        message("OK!");
+    }
+
+    protected static final void myStaticDo() {
+        sMessage = "OK!";
+    }
+
+    public void message(String s) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/FileManagerGetServiceLoaderTest.java	Wed Jul 05 22:14:23 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, 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 8164742
+ * @summary Test that jdk.compiler can materialize a service loader for arbitrary services
+ * @run main FileManagerGetServiceLoaderTest
+ */
+
+import javax.tools.*;
+
+public class FileManagerGetServiceLoaderTest {
+
+    public static void main(String... args) throws Exception {
+
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
+
+        /* FileManagerGetServiceLoaderTest.class is not really a service, but that is
+           immaterial to the test which just verifies addUses would have been called
+           so module boundary is not an issue for a class outside of jdk.compiler
+        */
+        java.util.ServiceLoader<?> loader = fm.getServiceLoader(StandardLocation.CLASS_PATH,
+                                     FileManagerGetServiceLoaderTest.class);
+        if (loader == null) {
+            throw new AssertionError("Could not obtain service loader");
+        }
+    }
+}