--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java Mon Mar 25 12:01:06 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java Mon Mar 25 18:20:16 2013 +0530
@@ -259,13 +259,29 @@
@Property(name = "Packages", attributes = Attribute.NOT_ENUMERABLE)
public volatile Object packages;
+ /** Nashorn extension: Java access - global.com */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public volatile Object com;
+
+ /** Nashorn extension: Java access - global.edu */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public volatile Object edu;
+
/** Nashorn extension: Java access - global.java */
@Property(attributes = Attribute.NOT_ENUMERABLE)
public volatile Object java;
+ /** Nashorn extension: Java access - global.javafx */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public volatile Object javafx;
+
/** Nashorn extension: Java access - global.javax */
@Property(attributes = Attribute.NOT_ENUMERABLE)
- public Object javax;
+ public volatile Object javax;
+
+ /** Nashorn extension: Java access - global.org */
+ @Property(attributes = Attribute.NOT_ENUMERABLE)
+ public volatile Object org;
/** Nashorn extension: Java access - global.javaImporter */
@Property(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
@@ -320,8 +336,12 @@
private ScriptFunction builtinTypeError;
private ScriptFunction builtinURIError;
private ScriptObject builtinPackages;
+ private ScriptObject builtinCom;
+ private ScriptObject builtinEdu;
private ScriptObject builtinJava;
+ private ScriptObject builtinJavafx;
private ScriptObject builtinJavax;
+ private ScriptObject builtinOrg;
private ScriptObject builtinJavaImporter;
private ScriptObject builtinJavaApi;
private ScriptObject builtinArrayBuffer;
@@ -1482,8 +1502,12 @@
private void initJavaAccess() {
final ScriptObject objectProto = getObjectPrototype();
this.builtinPackages = new NativeJavaPackage("", objectProto);
+ this.builtinCom = new NativeJavaPackage("com", objectProto);
+ this.builtinEdu = new NativeJavaPackage("edu", objectProto);
this.builtinJava = new NativeJavaPackage("java", objectProto);
+ this.builtinJavafx = new NativeJavaPackage("javafx", objectProto);
this.builtinJavax = new NativeJavaPackage("javax", objectProto);
+ this.builtinOrg = new NativeJavaPackage("org", objectProto);
this.builtinJavaImporter = initConstructor("JavaImporter");
this.builtinJavaApi = initConstructor("Java");
}
@@ -1566,8 +1590,12 @@
this.function = this.builtinFunction;
this.jsadapter = this.builtinJSAdapter;
this.json = this.builtinJSON;
+ this.com = this.builtinCom;
+ this.edu = this.builtinEdu;
this.java = this.builtinJava;
+ this.javafx = this.builtinJavafx;
this.javax = this.builtinJavax;
+ this.org = this.builtinOrg;
this.javaImporter = this.builtinJavaImporter;
this.javaApi = this.builtinJavaApi;
this.math = this.builtinMath;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8010709.js Mon Mar 25 18:20:16 2013 +0530
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+/**
+ * JDK-8010709 org on the top level doesn't resolve
+ *
+ * @test
+ * @run
+ */
+
+function check(pkgName) {
+ if (typeof this[pkgName] != 'object') {
+ fail(pkgName + " not defined");
+ }
+
+ if (String(this[pkgName]) != '[JavaPackage ' + pkgName + ']') {
+ fail(pkgName + " is not a JavaPackage");
+ }
+}
+
+check("com");
+check("edu");
+check("java");
+check("javafx");
+check("javax");
+check("org");