changeset 1657:22fa52ddaf66

8144568: ant clean test fails with jake/nashorn after recent sync with jdk9-dev
author sundar
date Thu, 03 Dec 2015 13:03:36 +0530
parents 3529de7a283c
children 9bf0a696b1bb
files make/project.properties src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/make/project.properties	Mon Nov 30 14:58:01 2015 -0800
+++ b/make/project.properties	Thu Dec 03 13:03:36 2015 +0530
@@ -126,6 +126,7 @@
     jdk.scripting.nashorn/jdk.nashorn.internal.parser=ALL-UNNAMED,\
     jdk.scripting.nashorn/jdk.nashorn.internal.objects=ALL-UNNAMED,\
     jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED,\
+    jdk.scripting.nashorn/jdk.nashorn.internal.runtime.doubleconv=ALL-UNNAMED,\
     jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker=ALL-UNNAMED,\
     jdk.scripting.nashorn/jdk.nashorn.internal.runtime.events=ALL-UNNAMED,\
     jdk.scripting.nashorn/jdk.nashorn.internal.runtime.options=ALL-UNNAMED,\
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Mon Nov 30 14:58:01 2015 -0800
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Thu Dec 03 13:03:36 2015 +0530
@@ -1301,7 +1301,16 @@
      * @return context
      */
     static Context fromClass(final Class<?> clazz) {
-        final ClassLoader loader = clazz.getClassLoader();
+        ClassLoader loader = null;
+        try {
+            loader = clazz.getClassLoader();
+        } catch (SecurityException ignored) {
+            // This could fail because of anonymous classes being used.
+            // Accessing loader of anonymous class fails (for extension
+            // loader class too?). In any case, for us fetching Context
+            // from class loader is just an optimization. We can always
+            // get Context from thread local storage (below).
+        }
 
         if (loader instanceof ScriptLoader) {
             return ((ScriptLoader)loader).getContext();