Merge
authorsundar
Fri, 11 Oct 2013 09:09:13 +0200
changeset 20936 a40c4a57bcc8
parent 20931 b0d58c5f4623 (current diff)
parent 20935 74220a6594bb (diff)
child 20940 0853aa84d530
Merge
--- a/nashorn/src/jdk/nashorn/api/scripting/JSObject.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/api/scripting/JSObject.java	Fri Oct 11 09:09:13 2013 +0200
@@ -46,7 +46,7 @@
      * @param args arguments to method
      * @return result of call
      */
-    public Object call(Object thiz, Object... args) {
+    public Object call(final Object thiz, final Object... args) {
         throw new UnsupportedOperationException("call");
     }
 
@@ -57,7 +57,7 @@
      * @param args arguments to method
      * @return result of constructor call
      */
-    public Object newObject(Object... args) {
+    public Object newObject(final Object... args) {
         throw new UnsupportedOperationException("newObject");
     }
 
@@ -67,7 +67,7 @@
      * @param s JavaScript expression to evaluate
      * @return evaluation result
      */
-    public Object eval(String s) {
+    public Object eval(final String s) {
         throw new UnsupportedOperationException("eval");
     }
 
@@ -78,7 +78,7 @@
      * @param args arguments to be passed to the member function
      * @return result of call
      */
-    public Object callMember(String name, Object... args) {
+    public Object callMember(final String name, final Object... args) {
         throw new UnsupportedOperationException("call");
     }
 
@@ -88,7 +88,7 @@
      * @param name of member
      * @return member
      */
-    public Object getMember(String name) {
+    public Object getMember(final String name) {
         return null;
     }
 
@@ -98,7 +98,7 @@
      * @param index index slot to retrieve
      * @return member
      */
-    public Object getSlot(int index) {
+    public Object getSlot(final int index) {
         return null;
     }
 
@@ -108,7 +108,7 @@
      * @param name name of member
      * @return true if this object has a member of the given name
      */
-    public boolean hasMember(String name) {
+    public boolean hasMember(final String name) {
         return false;
     }
 
@@ -118,7 +118,7 @@
      * @param slot index to check
      * @return true if this object has a slot
      */
-    public boolean hasSlot(int slot) {
+    public boolean hasSlot(final int slot) {
         return false;
     }
 
@@ -127,7 +127,8 @@
      *
      * @param name name of the member
      */
-    public void removeMember(String name) {
+    public void removeMember(final String name) {
+        //empty
     }
 
     /**
@@ -136,7 +137,8 @@
      * @param name  name of the member
      * @param value value of the member
      */
-    public void setMember(String name, Object value) {
+    public void setMember(final String name, final Object value) {
+        //empty
     }
 
     /**
@@ -145,7 +147,8 @@
      * @param index index of the member slot
      * @param value value of the member
      */
-    public void setSlot(int index, Object value) {
+    public void setSlot(final int index, final Object value) {
+        //empty
     }
 
     // property and value iteration
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Fri Oct 11 09:09:13 2013 +0200
@@ -285,11 +285,10 @@
                 final URL url = ((URLReader)reader).getURL();
                 final Charset cs = ((URLReader)reader).getCharset();
                 return new Source(url.toString(), url, cs);
-            } else {
-                return new Source(getScriptName(ctxt), Source.readFully(reader));
             }
-        } catch (final IOException ioExp) {
-            throw new ScriptException(ioExp);
+            return new Source(getScriptName(ctxt), Source.readFully(reader));
+        } catch (final IOException e) {
+            throw new ScriptException(e);
         }
     }
 
@@ -576,15 +575,14 @@
         return new CompiledScript() {
             @Override
             public Object eval(final ScriptContext ctxt) throws ScriptException {
-                final ScriptObject global = getNashornGlobalFrom(ctxt);
+                final ScriptObject globalObject = getNashornGlobalFrom(ctxt);
                 // Are we running the script in the correct global?
-                if (func.getScope() == global) {
-                    return evalImpl(func, ctxt, global);
-                } else {
-                    // ScriptContext with a different global. Compile again!
-                    // Note that we may still hit per-global compilation cache.
-                    return evalImpl(compileImpl(source, ctxt), ctxt, global);
+                if (func.getScope() == globalObject) {
+                    return evalImpl(func, ctxt, globalObject);
                 }
+                // ScriptContext with a different global. Compile again!
+                // Note that we may still hit per-global compilation cache.
+                return evalImpl(compileImpl(source, ctxt), ctxt, globalObject);
             }
             @Override
             public ScriptEngine getEngine() {
--- a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java	Fri Oct 11 09:09:13 2013 +0200
@@ -779,6 +779,10 @@
             return value;
         }
 
+        /**
+         * Get the array element type as Java format, e.g. [I
+         * @return array element type
+         */
         public ArrayType getArrayType() {
             if (elementType.isInteger()) {
                 return Type.INT_ARRAY;
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Fri Oct 11 09:09:13 2013 +0200
@@ -491,8 +491,8 @@
     // GlobalObject interface implementation
 
     @Override
-    public boolean isOfContext(final Context context) {
-        return this.context == context;
+    public boolean isOfContext(final Context ctxt) {
+        return this.context == ctxt;
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Fri Oct 11 09:09:13 2013 +0200
@@ -30,6 +30,7 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+
 import jdk.nashorn.api.scripting.NashornException;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
@@ -135,11 +136,12 @@
      * @param errorObj the error object
      * @return undefined
      */
+    @SuppressWarnings("unused")
     @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
     public static Object captureStackTrace(final Object self, final Object errorObj) {
         Global.checkObject(errorObj);
         final ScriptObject sobj = (ScriptObject)errorObj;
-        final ECMAException exp = new ECMAException(sobj, null);
+        new ECMAException(sobj, null); //constructor has side effects
         sobj.delete("stack", false);
         final ScriptFunction getStack = ScriptFunctionImpl.makeFunction("getStack", GET_STACK);
         final ScriptFunction setStack = ScriptFunctionImpl.makeFunction("setStack", SET_STACK);
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Fri Oct 11 09:09:13 2013 +0200
@@ -2113,7 +2113,7 @@
                 case "get":
                     final PropertyKey getIdent = propertyName();
                     final String getterName = getIdent.getPropertyName();
-                    final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, "get " + NameCodec.encode(getterName));
+                    final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName));
                     expect(LPAREN);
                     expect(RPAREN);
                     functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER);
@@ -2122,7 +2122,7 @@
                 case "set":
                     final PropertyKey setIdent = propertyName();
                     final String setterName = setIdent.getPropertyName();
-                    final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, "set " + NameCodec.encode(setterName));
+                    final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName));
                     expect(LPAREN);
                     final IdentNode argIdent = getIdent();
                     verifyStrictIdent(argIdent, "setter argument");
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Fri Oct 11 09:09:13 2013 +0200
@@ -249,7 +249,8 @@
     private static final ClassLoader myLoader = Context.class.getClassLoader();
     private static final StructureLoader sharedLoader;
 
-    /*package-private*/ ClassLoader getSharedLoader() {
+    /*package-private*/ @SuppressWarnings("static-method")
+    ClassLoader getSharedLoader() {
         return sharedLoader;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java	Fri Oct 11 09:09:13 2013 +0200
@@ -65,7 +65,17 @@
         } else {
             this.logger = Logging.getLogger(loggerName);
         }
-        this.isEnabled = logger.getLevel() != Level.OFF;
+        assert logger != null;
+        this.isEnabled = getLevel() != Level.OFF;
+    }
+
+    /**
+     * Do not currently support chaining this with parent logger. Logger level null
+     * means disabled
+     * @return level
+     */
+    private Level getLevel() {
+        return logger.getLevel() == null ? Level.OFF : logger.getLevel();
     }
 
     /**
@@ -126,7 +136,7 @@
      * @return true if level is above the given one
      */
     public boolean levelAbove(final Level level) {
-        return logger.getLevel().intValue() > level.intValue();
+        return getLevel().intValue() > level.intValue();
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/GlobalObject.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/GlobalObject.java	Fri Oct 11 09:09:13 2013 +0200
@@ -38,9 +38,10 @@
 public interface GlobalObject {
     /**
      * Is this global of the given Context?
+     * @param ctxt the context
      * @return true if this global belongs to the given Context
      */
-    public boolean isOfContext(Context context);
+    public boolean isOfContext(final Context ctxt);
 
     /**
      * Does this global belong to a strict Context?
--- a/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Fri Oct 11 09:09:13 2013 +0200
@@ -119,10 +119,11 @@
                 });
     }
 
+    /** wrapped object */
     protected final Object obj;
 
     // allow subclasses only in this package
-    ListAdapter(Object obj) {
+    ListAdapter(final Object obj) {
         this.obj = obj;
     }
 
@@ -143,22 +144,32 @@
     }
 
     @Override
-    public final Object get(int index) {
+    public final Object get(final int index) {
         checkRange(index);
         return getAt(index);
     }
 
+    /**
+     * Get object at an index
+     * @param index index in list
+     * @return object
+     */
     protected abstract Object getAt(final int index);
 
     @Override
-    public Object set(int index, Object element) {
+    public Object set(final int index, final Object element) {
         checkRange(index);
         final Object prevValue = getAt(index);
         setAt(index, element);
         return prevValue;
     }
 
-    protected abstract void setAt(int index, Object element);
+    /**
+     * Set object at an index
+     * @param index   index in list
+     * @param element element
+     */
+    protected abstract void setAt(final int index, final Object element);
 
     private void checkRange(int index) {
         if(index < 0 || index >= size()) {
@@ -167,18 +178,18 @@
     }
 
     @Override
-    public final void push(Object e) {
+    public final void push(final Object e) {
         addFirst(e);
     }
 
     @Override
-    public final boolean add(Object e) {
+    public final boolean add(final Object e) {
         addLast(e);
         return true;
     }
 
     @Override
-    public final void addFirst(Object e) {
+    public final void addFirst(final Object e) {
         try {
             final InvokeByName unshiftInvoker = getUNSHIFT();
             final Object fn = unshiftInvoker.getGetter().invokeExact(obj);
@@ -192,7 +203,7 @@
     }
 
     @Override
-    public final void addLast(Object e) {
+    public final void addLast(final Object e) {
         try {
             final InvokeByName pushInvoker = getPUSH();
             final Object fn = pushInvoker.getGetter().invokeExact(obj);
@@ -206,7 +217,7 @@
     }
 
     @Override
-    public final void add(int index, Object e) {
+    public final void add(final int index, final Object e) {
         try {
             if(index < 0) {
                 throw invalidIndex(index);
@@ -225,35 +236,35 @@
                     throw invalidIndex(index);
                 }
             }
-        } catch(RuntimeException | Error ex) {
+        } catch(final RuntimeException | Error ex) {
             throw ex;
-        } catch(Throwable t) {
+        } catch(final Throwable t) {
             throw new RuntimeException(t);
         }
     }
-    private static void checkFunction(Object fn, InvokeByName invoke) {
+    private static void checkFunction(final Object fn, final InvokeByName invoke) {
         if(!(Bootstrap.isCallable(fn))) {
             throw new UnsupportedOperationException("The script object doesn't have a function named " + invoke.getName());
         }
     }
 
-    private static IndexOutOfBoundsException invalidIndex(int index) {
+    private static IndexOutOfBoundsException invalidIndex(final int index) {
         return new IndexOutOfBoundsException(String.valueOf(index));
     }
 
     @Override
-    public final boolean offer(Object e) {
+    public final boolean offer(final Object e) {
         return offerLast(e);
     }
 
     @Override
-    public final boolean offerFirst(Object e) {
+    public final boolean offerFirst(final Object e) {
         addFirst(e);
         return true;
     }
 
     @Override
-    public final boolean offerLast(Object e) {
+    public final boolean offerLast(final Object e) {
         addLast(e);
         return true;
     }
@@ -287,7 +298,7 @@
     }
 
     @Override
-    public final Object remove(int index) {
+    public final Object remove(final int index) {
         if(index < 0) {
             throw invalidIndex(index);
         } else if (index == 0) {
@@ -333,11 +344,11 @@
     }
 
     @Override
-    protected final void removeRange(int fromIndex, int toIndex) {
+    protected final void removeRange(final int fromIndex, final int toIndex) {
         invokeSpliceRemove(fromIndex, toIndex - fromIndex);
     }
 
-    private void invokeSpliceRemove(int fromIndex, int count) {
+    private void invokeSpliceRemove(final int fromIndex, final int count) {
         try {
             final InvokeByName spliceRemoveInvoker = getSPLICE_REMOVE();
             final Object fn = spliceRemoveInvoker.getGetter().invokeExact(obj);
@@ -419,16 +430,16 @@
     }
 
     @Override
-    public final boolean removeFirstOccurrence(Object o) {
+    public final boolean removeFirstOccurrence(final Object o) {
         return removeOccurrence(o, iterator());
     }
 
     @Override
-    public final boolean removeLastOccurrence(Object o) {
+    public final boolean removeLastOccurrence(final Object o) {
         return removeOccurrence(o, descendingIterator());
     }
 
-    private static boolean removeOccurrence(Object o, Iterator<Object> it) {
+    private static boolean removeOccurrence(final Object o, final Iterator<Object> it) {
         while(it.hasNext()) {
             final Object e = it.next();
             if(o == null ? e == null : o.equals(e)) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Fri Oct 11 09:09:13 2013 +0200
@@ -33,6 +33,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedList;
+import jdk.internal.dynalink.support.NameCodec;
 
 import jdk.nashorn.internal.codegen.Compiler;
 import jdk.nashorn.internal.codegen.CompilerConstants;
@@ -100,9 +101,7 @@
      * @param allocatorMap       allocator map to seed instances with, when constructing
      */
     public RecompilableScriptFunctionData(final FunctionNode functionNode, final CodeInstaller<ScriptEnvironment> installer, final String allocatorClassName, final PropertyMap allocatorMap) {
-        super(functionNode.isAnonymous() ?
-                "" :
-                functionNode.getIdent().getName(),
+        super(functionName(functionNode),
               functionNode.getParameters().size(),
               functionNode.isStrict(),
               false,
@@ -139,6 +138,20 @@
         return sb.toString() + super.toString();
     }
 
+    private static String functionName(final FunctionNode fn) {
+        if (fn.isAnonymous()) {
+            return "";
+        } else {
+            final FunctionNode.Kind kind = fn.getKind();
+            if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) {
+                final String name = NameCodec.decode(fn.getIdent().getName());
+                return name.substring(4); // 4 is "get " or "set "
+            } else {
+                return fn.getIdent().getName();
+            }
+        }
+    }
+
     private static long tokenFor(final FunctionNode fn) {
         final int  position   = Token.descPosition(fn.getFirstToken());
         final int  length     = Token.descPosition(fn.getLastToken()) - position + Token.descLength(fn.getLastToken());
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Fri Oct 11 09:09:13 2013 +0200
@@ -326,7 +326,7 @@
      * @param self self reference
      * @return bound invoke handle
      */
-    public final MethodHandle getBoundInvokeHandle(final ScriptObject self) {
+    public final MethodHandle getBoundInvokeHandle(final Object self) {
         return MH.bindTo(bindToCalleeIfNeeded(data.getGenericInvoker()), self);
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java	Fri Oct 11 09:09:13 2013 +0200
@@ -64,6 +64,7 @@
                     return context.getSharedLoader().loadClass(name);
                 }
             } catch (final ClassNotFoundException ignored) {
+                //ignored
             }
 
             // throw the original exception from here
--- a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Fri Oct 11 09:09:13 2013 +0200
@@ -316,6 +316,10 @@
         return expression;
     }
 
+    /**
+     * Get the parent scope for this {@code WithObject}
+     * @return the parent scope
+     */
     public ScriptObject getParentScope() {
         return getProto();
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Fri Oct 11 09:09:13 2013 +0200
@@ -93,7 +93,7 @@
  * its last argument preceded by original constructor arguments. This constructor will use the passed function as the
  * implementation for all abstract methods. For consistency, any concrete methods sharing the single abstract method
  * name will also be overridden by the function. When methods on the adapter instance are invoked, the ScriptFunction is
- * invoked with {@code null} as its "this".
+ * invoked with global or UNDEFINED as its "this" depending whether the function is non-strict or not.
  * </li>
  * <li>
  * If the adapter being generated can have class-level overrides, constructors taking same arguments as the superclass
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Fri Oct 11 09:09:13 2013 +0200
@@ -29,6 +29,7 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodType;
+import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -53,8 +54,8 @@
      * @return the appropriately adapted method handle for invoking the script function.
      */
     public static MethodHandle getHandle(final ScriptFunction fn, final MethodType type) {
-        // JS "this" will be null for SAMs
-        return adaptHandle(fn.getBoundInvokeHandle(null), type);
+        // JS "this" will be global object or undefined depending on if 'fn' is strict or not
+        return adaptHandle(fn.getBoundInvokeHandle(fn.isStrict()? ScriptRuntime.UNDEFINED : Context.getGlobal()), type);
     }
 
     /**
--- a/nashorn/test/script/basic/JDK-8025488.js	Thu Oct 10 13:41:19 2013 -0700
+++ b/nashorn/test/script/basic/JDK-8025488.js	Fri Oct 11 09:09:13 2013 +0200
@@ -40,4 +40,4 @@
 }
 
 var e = new MyError(); 
-print(e.stack);
+print(e.stack.replace(/\\/g, '/'));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026162.js	Fri Oct 11 09:09:13 2013 +0200
@@ -0,0 +1,48 @@
+/*
+ * 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-8026162: "this" in SAM adapter functions is wrong
+ *
+ * @test
+ * @run
+ */
+
+var global = this;
+
+new java.lang.Runnable(
+  function func() {
+      if (this !== global) {
+          fail("Expected 'this' to be global instance");
+      }
+  }
+).run();
+
+new java.lang.Runnable(
+  function func() {
+      'use strict';
+      if (typeof this != 'undefined') {
+          fail("Expected 'undefined' to be global instance");
+      }
+  }
+).run();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026264.js	Fri Oct 11 09:09:13 2013 +0200
@@ -0,0 +1,54 @@
+/*
+ * 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-8026264: Getter, setter function name mangling issues
+ *
+ * @test
+ * @run
+ */
+
+var obj = {
+   get ":"(){},
+   set ":"(x){},
+   get ""(){},
+   set ""(x){}
+};
+
+var desc = Object.getOwnPropertyDescriptor(obj, ":");
+if (desc.get.name != ':') {
+    fail("getter name is expected to be ':' got " + desc.get.name);
+}
+
+if (desc.set.name != ':') {
+    fail("setter name is expected to be ':' got " + desc.set.name);
+}
+
+desc = Object.getOwnPropertyDescriptor(obj, "");
+if (desc.get.name != '') {
+    fail("getter name is expected to be '' got " + desc.get.name);
+}
+
+if (desc.set.name != '') {
+    fail("setter name is expected to be '' got " + desc.set.name);
+}