aboutsummaryrefslogtreecommitdiff
path: root/src/jdk/nashorn/internal/runtime/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/jdk/nashorn/internal/runtime/resources')
-rw-r--r--src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js18
-rw-r--r--src/jdk/nashorn/internal/runtime/resources/parser.js10
2 files changed, 15 insertions, 13 deletions
diff --git a/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js b/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js
index 15c67f94..0b967d69 100644
--- a/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js
+++ b/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2010, 2013, 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.
@@ -34,7 +34,7 @@ Object.defineProperty(this, "JavaAdapter", {
if (arguments.length < 2) {
throw new TypeError("JavaAdapter requires atleast two arguments");
}
-
+
var types = Array.prototype.slice.call(arguments, 0, arguments.length - 1);
var NewType = Java.extend.apply(Java, types);
return new NewType(arguments[arguments.length - 1]);
@@ -56,10 +56,10 @@ Object.defineProperty(this, "importPackage", {
return type;
} catch (e) {}
}
-
+
return oldNoSuchProperty? oldNoSuchProperty(name) : undefined;
}
-
+
var prefix = "[JavaPackage ";
return function() {
for (var i in arguments) {
@@ -343,7 +343,9 @@ Object.defineProperty(this, "importClass", {
configurable: true, enumerable: false, writable: true,
value: function(clazz) {
if (Java.isType(clazz)) {
- this[clazz.class.getSimpleName()] = clazz;
+ var className = Java.typeName(clazz);
+ var simpleName = className.substring(className.lastIndexOf('.') + 1);
+ this[simpleName] = clazz;
} else {
throw new TypeError(clazz + " is not a Java class");
}
diff --git a/src/jdk/nashorn/internal/runtime/resources/parser.js b/src/jdk/nashorn/internal/runtime/resources/parser.js
index b89f7e12..8671d365 100644
--- a/src/jdk/nashorn/internal/runtime/resources/parser.js
+++ b/src/jdk/nashorn/internal/runtime/resources/parser.js
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2010, 2013, 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.
@@ -47,7 +47,7 @@ function parse(/*code, [name], [location]*/) {
code = arguments[0];
}
- var jsonStr = Packages.jdk.nashorn.internal.runtime.ScriptRuntime.parse(code, name, location);
+ var jsonStr = Packages.jdk.nashorn.api.scripting.ScriptUtils.parse(code, name, location);
return JSON.parse(jsonStr,
function (prop, value) {
if (typeof(value) == 'string' && prop == "value") {