Merge

Thu, 04 Jul 2013 17:28:04 +0200

author
lagergren
date
Thu, 04 Jul 2013 17:28:04 +0200
changeset 413
8c4a6d9b8a23
parent 412
be2087629eb9
parent 411
ad6b18ee4666
child 414
ec84ba68ad39

Merge

test/script/currently-failing/JDK-8019809.js file | annotate | diff | comparison | revisions
     1.1 --- a/docs/JavaScriptingProgrammersGuide.html	Thu Jul 04 17:27:33 2013 +0200
     1.2 +++ b/docs/JavaScriptingProgrammersGuide.html	Thu Jul 04 17:28:04 2013 +0200
     1.3 @@ -501,14 +501,19 @@
     1.4   var anArrayListWithSize = new ArrayList(16)
     1.5  </code></pre> 
     1.6  
     1.7 -In the special case of inner classes, you need to use the JVM fully qualified name, meaning using $ sign in the class name:
     1.8 +In the special case of inner classes, you can either use the JVM fully qualified name, meaning using the dollar sign in the class name, or you can use the dot:
     1.9  
    1.10  <pre><code>
    1.11   var ftype = Java.type("java.awt.geom.Arc2D$Float")
    1.12  </code></pre> 
    1.13   
    1.14 +and
    1.15 + 
    1.16 +<pre><code>
    1.17 + var ftype = Java.type("java.awt.geom.Arc2D.Float")
    1.18 +</code></pre> 
    1.19  
    1.20 -However, once you retrieved the outer class, you can access the inner class as a property on it:
    1.21 +both work. Note however that using the dollar sign is faster, as Java.type first tries to resolve the class name as it is originally specified, and the internal JVM names for inner classes use the dollar sign. If you use the dot, Java.type will internally get a ClassNotFoundException and subsequently retry by changing the last dot to dollar sign. As a matter of fact, it'll keep replacing dots with dollar signs until it either successfully loads the class or runs out of all dots in the name. This way it can correctly resolve and load even multiply nested inner classes with the dot notation. Again, this will be slower than using the dollar signs in the name. An alternative way to access the inner class is as a property of the outer class:
    1.22  
    1.23  <pre><code>
    1.24   var arctype = Java.type("java.awt.geom.Arc2D")
     2.1 --- a/src/jdk/nashorn/internal/codegen/Lower.java	Thu Jul 04 17:27:33 2013 +0200
     2.2 +++ b/src/jdk/nashorn/internal/codegen/Lower.java	Thu Jul 04 17:28:04 2013 +0200
     2.3 @@ -32,6 +32,7 @@
     2.4  import java.util.ArrayList;
     2.5  import java.util.Arrays;
     2.6  import java.util.List;
     2.7 +import java.util.ListIterator;
     2.8  import jdk.nashorn.internal.ir.BaseNode;
     2.9  import jdk.nashorn.internal.ir.BinaryNode;
    2.10  import jdk.nashorn.internal.ir.Block;
    2.11 @@ -115,6 +116,21 @@
    2.12                  }
    2.13                  return newStatements;
    2.14              }
    2.15 +
    2.16 +            @Override
    2.17 +            protected Block afterSetStatements(final Block block) {
    2.18 +                final List<Statement> stmts = block.getStatements();
    2.19 +                for(final ListIterator<Statement> li = stmts.listIterator(stmts.size()); li.hasPrevious();) {
    2.20 +                    final Statement stmt = li.previous();
    2.21 +                    // popStatements() guarantees that the only thing after a terminal statement are uninitialized
    2.22 +                    // VarNodes. We skip past those, and set the terminal state of the block to the value of the
    2.23 +                    // terminal state of the first statement that is not an uninitialized VarNode.
    2.24 +                    if(!(stmt instanceof VarNode && ((VarNode)stmt).getInit() == null)) {
    2.25 +                        return block.setIsTerminal(this, stmt.isTerminal());
    2.26 +                    }
    2.27 +                }
    2.28 +                return block.setIsTerminal(this, false);
    2.29 +            }
    2.30          });
    2.31      }
    2.32  
    2.33 @@ -132,11 +148,11 @@
    2.34          //now we have committed the entire statement list to the block, but we need to truncate
    2.35          //whatever is after the last terminal. block append won't append past it
    2.36  
    2.37 -        Statement last = lc.getLastStatement();
    2.38  
    2.39          if (lc.isFunctionBody()) {
    2.40              final FunctionNode currentFunction = lc.getCurrentFunction();
    2.41              final boolean isProgram = currentFunction.isProgram();
    2.42 +            final Statement last = lc.getLastStatement();
    2.43              final ReturnNode returnNode = new ReturnNode(
    2.44                  last == null ? block.getLineNumber() : last.getLineNumber(), //TODO?
    2.45                  currentFunction.getToken(),
    2.46 @@ -145,11 +161,7 @@
    2.47                      compilerConstant(RETURN) :
    2.48                      LiteralNode.newInstance(block, ScriptRuntime.UNDEFINED));
    2.49  
    2.50 -            last = (Statement)returnNode.accept(this);
    2.51 -        }
    2.52 -
    2.53 -        if (last != null && last.isTerminal()) {
    2.54 -            return block.setIsTerminal(lc, true);
    2.55 +            returnNode.accept(this);
    2.56          }
    2.57  
    2.58          return block;
     3.1 --- a/src/jdk/nashorn/internal/ir/BlockLexicalContext.java	Thu Jul 04 17:27:33 2013 +0200
     3.2 +++ b/src/jdk/nashorn/internal/ir/BlockLexicalContext.java	Thu Jul 04 17:28:04 2013 +0200
     3.3 @@ -29,7 +29,6 @@
     3.4  import java.util.ArrayList;
     3.5  import java.util.Deque;
     3.6  import java.util.List;
     3.7 -import java.util.ListIterator;
     3.8  
     3.9  /**
    3.10   * This is a subclass of lexical context used for filling
    3.11 @@ -63,6 +62,16 @@
    3.12          return sstack.pop();
    3.13      }
    3.14  
    3.15 +    /**
    3.16 +     * Override this method to perform some additional processing on the block after its statements have been set. By
    3.17 +     * default does nothing and returns the original block.
    3.18 +     * @param block the block to operate on
    3.19 +     * @return a modified block.
    3.20 +     */
    3.21 +    protected Block afterSetStatements(Block block) {
    3.22 +        return block;
    3.23 +    }
    3.24 +
    3.25      @SuppressWarnings("unchecked")
    3.26      @Override
    3.27      public <T extends LexicalContextNode> T pop(final T node) {
    3.28 @@ -70,6 +79,7 @@
    3.29          if (node instanceof Block) {
    3.30              final List<Statement> newStatements = popStatements();
    3.31              expected = (T)((Block)node).setStatements(this, newStatements);
    3.32 +            expected = (T)afterSetStatements((Block)expected);
    3.33              if (!sstack.isEmpty()) {
    3.34                  lastStatement = lastStatement(sstack.peek());
    3.35              }
    3.36 @@ -107,10 +117,7 @@
    3.37      }
    3.38  
    3.39      private static Statement lastStatement(final List<Statement> statements) {
    3.40 -        for (final ListIterator<Statement> iter = statements.listIterator(statements.size()); iter.hasPrevious(); ) {
    3.41 -            final Statement node = iter.previous();
    3.42 -            return node;
    3.43 -        }
    3.44 -        return null;
    3.45 +        final int s = statements.size();
    3.46 +        return s == 0 ? null : statements.get(s - 1);
    3.47      }
    3.48  }
     4.1 --- a/src/jdk/nashorn/internal/objects/NativeJava.java	Thu Jul 04 17:27:33 2013 +0200
     4.2 +++ b/src/jdk/nashorn/internal/objects/NativeJava.java	Thu Jul 04 17:28:04 2013 +0200
     4.3 @@ -39,6 +39,7 @@
     4.4  import jdk.nashorn.internal.objects.annotations.Function;
     4.5  import jdk.nashorn.internal.objects.annotations.ScriptClass;
     4.6  import jdk.nashorn.internal.objects.annotations.Where;
     4.7 +import jdk.nashorn.internal.runtime.Context;
     4.8  import jdk.nashorn.internal.runtime.JSType;
     4.9  import jdk.nashorn.internal.runtime.ListAdapter;
    4.10  import jdk.nashorn.internal.runtime.PropertyMap;
    4.11 @@ -105,12 +106,22 @@
    4.12       * var anArrayList = new ArrayList
    4.13       * var anArrayListWithSize = new ArrayList(16)
    4.14       * </pre>
    4.15 -     * In the special case of inner classes, you need to use the JVM fully qualified name, meaning using {@code $} sign
    4.16 -     * in the class name:
    4.17 +     * In the special case of inner classes, you can either use the JVM fully qualified name, meaning using {@code $}
    4.18 +     * sign in the class name, or you can use the dot:
    4.19       * <pre>
    4.20       * var ftype = Java.type("java.awt.geom.Arc2D$Float")
    4.21       * </pre>
    4.22 -     * However, once you retrieved the outer class, you can access the inner class as a property on it:
    4.23 +     * and
    4.24 +     * <pre>
    4.25 +     * var ftype = Java.type("java.awt.geom.Arc2D.Float")
    4.26 +     * </pre>
    4.27 +     * both work. Note however that using the dollar sign is faster, as Java.type first tries to resolve the class name
    4.28 +     * as it is originally specified, and the internal JVM names for inner classes use the dollar sign. If you use the
    4.29 +     * dot, Java.type will internally get a ClassNotFoundException and subsequently retry by changing the last dot to
    4.30 +     * dollar sign. As a matter of fact, it'll keep replacing dots with dollar signs until it either successfully loads
    4.31 +     * the class or runs out of all dots in the name. This way it can correctly resolve and load even multiply nested
    4.32 +     * inner classes with the dot notation. Again, this will be slower than using the dollar signs in the name. An
    4.33 +     * alternative way to access the inner class is as a property of the outer class:
    4.34       * <pre>
    4.35       * var arctype = Java.type("java.awt.geom.Arc2D")
    4.36       * var ftype = arctype.Float
    4.37 @@ -390,7 +401,33 @@
    4.38  
    4.39      private static Class<?> simpleType(final String typeName) throws ClassNotFoundException {
    4.40          final Class<?> primClass = TypeUtilities.getPrimitiveTypeByName(typeName);
    4.41 -        return primClass != null ? primClass : Global.getThisContext().findClass(typeName);
    4.42 +        if(primClass != null) {
    4.43 +            return primClass;
    4.44 +        }
    4.45 +        final Context ctx = Global.getThisContext();
    4.46 +        try {
    4.47 +            return ctx.findClass(typeName);
    4.48 +        } catch(ClassNotFoundException e) {
    4.49 +            // The logic below compensates for a frequent user error - when people use dot notation to separate inner
    4.50 +            // class names, i.e. "java.lang.Character.UnicodeBlock" vs."java.lang.Character$UnicodeBlock". The logic
    4.51 +            // below will try alternative class names, replacing dots at the end of the name with dollar signs.
    4.52 +            final StringBuilder nextName = new StringBuilder(typeName);
    4.53 +            int lastDot = nextName.length();
    4.54 +            for(;;) {
    4.55 +                lastDot = nextName.lastIndexOf(".", lastDot - 1);
    4.56 +                if(lastDot == -1) {
    4.57 +                    // Exhausted the search space, class not found - rethrow the original exception.
    4.58 +                    throw e;
    4.59 +                }
    4.60 +                nextName.setCharAt(lastDot, '$');
    4.61 +                try {
    4.62 +                    return ctx.findClass(nextName.toString());
    4.63 +                } catch(ClassNotFoundException cnfe) {
    4.64 +                    // Intentionally ignored, so the loop retries with the next name
    4.65 +                }
    4.66 +            }
    4.67 +        }
    4.68 +
    4.69      }
    4.70  
    4.71      private static Class<?> arrayType(final String typeName) throws ClassNotFoundException {
     5.1 --- a/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Thu Jul 04 17:27:33 2013 +0200
     5.2 +++ b/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Thu Jul 04 17:28:04 2013 +0200
     5.3 @@ -75,6 +75,8 @@
     5.4  
     5.5      private static final MethodType[] ACCESSOR_GETTER_TYPES = new MethodType[NOOF_TYPES];
     5.6      private static final MethodType[] ACCESSOR_SETTER_TYPES = new MethodType[NOOF_TYPES];
     5.7 +    private static final MethodType ACCESSOR_GETTER_PRIMITIVE_TYPE;
     5.8 +    private static final MethodType ACCESSOR_SETTER_PRIMITIVE_TYPE;
     5.9      private static final MethodHandle SPILL_ELEMENT_GETTER;
    5.10      private static final MethodHandle SPILL_ELEMENT_SETTER;
    5.11  
    5.12 @@ -82,13 +84,25 @@
    5.13      private static final MethodHandle[] SPILL_ACCESSORS = new MethodHandle[SPILL_CACHE_SIZE * 2];
    5.14  
    5.15      static {
    5.16 +        MethodType getterPrimitiveType = null;
    5.17 +        MethodType setterPrimitiveType = null;
    5.18 +
    5.19          for (int i = 0; i < NOOF_TYPES; i++) {
    5.20              final Type type = ACCESSOR_TYPES.get(i);
    5.21              ACCESSOR_GETTER_TYPES[i] = MH.type(type.getTypeClass(), Object.class);
    5.22              ACCESSOR_SETTER_TYPES[i] = MH.type(void.class, Object.class, type.getTypeClass());
    5.23 +
    5.24 +            if (type == PRIMITIVE_TYPE) {
    5.25 +                getterPrimitiveType = ACCESSOR_GETTER_TYPES[i];
    5.26 +                setterPrimitiveType = ACCESSOR_SETTER_TYPES[i];
    5.27 +            }
    5.28          }
    5.29  
    5.30 -        final MethodHandle spillGetter = MH.getter(MethodHandles.lookup(), ScriptObject.class, "spill", Object[].class);
    5.31 +        ACCESSOR_GETTER_PRIMITIVE_TYPE = getterPrimitiveType;
    5.32 +        ACCESSOR_SETTER_PRIMITIVE_TYPE = setterPrimitiveType;
    5.33 +
    5.34 +        final MethodType spillGetterType = MethodType.methodType(Object[].class, Object.class);
    5.35 +        final MethodHandle spillGetter = MH.asType(MH.getter(MethodHandles.lookup(), ScriptObject.class, "spill", Object[].class), spillGetterType);
    5.36          SPILL_ELEMENT_GETTER = MH.filterArguments(MH.arrayElementGetter(Object[].class), 0, spillGetter);
    5.37          SPILL_ELEMENT_SETTER = MH.filterArguments(MH.arrayElementSetter(Object[].class), 0, spillGetter);
    5.38      }
    5.39 @@ -177,9 +191,8 @@
    5.40                      ACCESSOR_GETTER_TYPES[i]);
    5.41              }
    5.42          } else {
    5.43 -            //this will work as the object setter and getter will be converted appropriately
    5.44 -            objectGetter = getter;
    5.45 -            objectSetter = setter;
    5.46 +            objectGetter = getter.type() != Lookup.GET_OBJECT_TYPE ? MH.asType(getter, Lookup.GET_OBJECT_TYPE) : getter;
    5.47 +            objectSetter = setter != null && setter.type() != Lookup.SET_OBJECT_TYPE ? MH.asType(setter, Lookup.SET_OBJECT_TYPE) : setter;
    5.48          }
    5.49  
    5.50          setCurrentType(getterType);
    5.51 @@ -195,8 +208,8 @@
    5.52              setters = new MethodHandle[fieldCount];
    5.53              for(int i = 0; i < fieldCount; ++i) {
    5.54                  final String fieldName = ObjectClassGenerator.getFieldName(i, Type.OBJECT);
    5.55 -                getters[i] = MH.getter(lookup, structure, fieldName, Type.OBJECT.getTypeClass());
    5.56 -                setters[i] = MH.setter(lookup, structure, fieldName, Type.OBJECT.getTypeClass());
    5.57 +                getters[i] = MH.asType(MH.getter(lookup, structure, fieldName, Type.OBJECT.getTypeClass()), Lookup.GET_OBJECT_TYPE);
    5.58 +                setters[i] = MH.asType(MH.setter(lookup, structure, fieldName, Type.OBJECT.getTypeClass()), Lookup.SET_OBJECT_TYPE);
    5.59              }
    5.60          }
    5.61      }
    5.62 @@ -224,17 +237,18 @@
    5.63              final MethodHandle arguments   = MH.getter(lookup, structure, "arguments", Object.class);
    5.64              final MethodHandle argumentsSO = MH.asType(arguments, arguments.type().changeReturnType(ScriptObject.class));
    5.65  
    5.66 -            objectGetter = MH.insertArguments(MH.filterArguments(ScriptObject.GET_ARGUMENT.methodHandle(), 0, argumentsSO), 1, slot);
    5.67 -            objectSetter = MH.insertArguments(MH.filterArguments(ScriptObject.SET_ARGUMENT.methodHandle(), 0, argumentsSO), 1, slot);
    5.68 +            objectGetter = MH.asType(MH.insertArguments(MH.filterArguments(ScriptObject.GET_ARGUMENT.methodHandle(), 0, argumentsSO), 1, slot), Lookup.GET_OBJECT_TYPE);
    5.69 +            objectSetter = MH.asType(MH.insertArguments(MH.filterArguments(ScriptObject.SET_ARGUMENT.methodHandle(), 0, argumentsSO), 1, slot), Lookup.SET_OBJECT_TYPE);
    5.70          } else {
    5.71              final GettersSetters gs = GETTERS_SETTERS.get(structure);
    5.72              objectGetter = gs.getters[slot];
    5.73              objectSetter = gs.setters[slot];
    5.74  
    5.75              if (!OBJECT_FIELDS_ONLY) {
    5.76 -                final String fieldNamePrimitive = ObjectClassGenerator.getFieldName(slot, ObjectClassGenerator.PRIMITIVE_TYPE);
    5.77 -                primitiveGetter = MH.getter(lookup, structure, fieldNamePrimitive, PRIMITIVE_TYPE.getTypeClass());
    5.78 -                primitiveSetter = MH.setter(lookup, structure, fieldNamePrimitive, PRIMITIVE_TYPE.getTypeClass());
    5.79 +                final String fieldNamePrimitive = ObjectClassGenerator.getFieldName(slot, PRIMITIVE_TYPE);
    5.80 +                final Class<?> typeClass = PRIMITIVE_TYPE.getTypeClass();
    5.81 +                primitiveGetter = MH.asType(MH.getter(lookup, structure, fieldNamePrimitive, typeClass), ACCESSOR_GETTER_PRIMITIVE_TYPE);
    5.82 +                primitiveSetter = MH.asType(MH.setter(lookup, structure, fieldNamePrimitive, typeClass), ACCESSOR_SETTER_PRIMITIVE_TYPE);
    5.83              }
    5.84          }
    5.85  
    5.86 @@ -325,16 +339,8 @@
    5.87          final int i = getAccessorTypeIndex(type);
    5.88          if (getters[i] == null) {
    5.89              getters[i] = debug(
    5.90 -                MH.asType(
    5.91 -                    createGetter(
    5.92 -                        currentType,
    5.93 -                        type,
    5.94 -                        primitiveGetter,
    5.95 -                        objectGetter),
    5.96 -                    ACCESSOR_GETTER_TYPES[i]),
    5.97 -                currentType,
    5.98 -                type,
    5.99 -                "get");
   5.100 +                createGetter(currentType, type, primitiveGetter, objectGetter),
   5.101 +                currentType, type, "get");
   5.102          }
   5.103  
   5.104          return getters[i];
   5.105 @@ -370,7 +376,6 @@
   5.106              objectSetter = getSpillSetter();
   5.107          }
   5.108          MethodHandle mh = createSetter(forType, type, primitiveSetter, objectSetter);
   5.109 -        mh = MH.asType(mh, ACCESSOR_SETTER_TYPES[getAccessorTypeIndex(type)]); //has to be the case for invokeexact to work in ScriptObject
   5.110          mh = debug(mh, currentType, type, "set");
   5.111          return mh;
   5.112      }
   5.113 @@ -423,9 +428,9 @@
   5.114          final int slot = getSlot();
   5.115          MethodHandle getter = slot < SPILL_CACHE_SIZE ? SPILL_ACCESSORS[slot * 2] : null;
   5.116          if (getter == null) {
   5.117 -            getter = MH.asType(MH.insertArguments(SPILL_ELEMENT_GETTER, 1, slot), Lookup.GET_OBJECT_TYPE);
   5.118 +            getter = MH.insertArguments(SPILL_ELEMENT_GETTER, 1, slot);
   5.119              if (slot < SPILL_CACHE_SIZE) {
   5.120 -                SPILL_ACCESSORS[slot * 2] = getter;
   5.121 +                SPILL_ACCESSORS[slot * 2 + 0] = getter;
   5.122              }
   5.123          }
   5.124          return getter;
   5.125 @@ -435,7 +440,7 @@
   5.126          final int slot = getSlot();
   5.127          MethodHandle setter = slot < SPILL_CACHE_SIZE ? SPILL_ACCESSORS[slot * 2 + 1] : null;
   5.128          if (setter == null) {
   5.129 -            setter = MH.asType(MH.insertArguments(SPILL_ELEMENT_SETTER, 1, slot), Lookup.SET_OBJECT_TYPE);
   5.130 +            setter = MH.insertArguments(SPILL_ELEMENT_SETTER, 1, slot);
   5.131              if (slot < SPILL_CACHE_SIZE) {
   5.132                  SPILL_ACCESSORS[slot * 2 + 1] = setter;
   5.133              }
     6.1 --- a/src/jdk/nashorn/internal/runtime/ListAdapter.java	Thu Jul 04 17:27:33 2013 +0200
     6.2 +++ b/src/jdk/nashorn/internal/runtime/ListAdapter.java	Thu Jul 04 17:28:04 2013 +0200
     6.3 @@ -1,3 +1,28 @@
     6.4 +/*
     6.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.7 + *
     6.8 + * This code is free software; you can redistribute it and/or modify it
     6.9 + * under the terms of the GNU General Public License version 2 only, as
    6.10 + * published by the Free Software Foundation.  Oracle designates this
    6.11 + * particular file as subject to the "Classpath" exception as provided
    6.12 + * by Oracle in the LICENSE file that accompanied this code.
    6.13 + *
    6.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    6.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.17 + * version 2 for more details (a copy is included in the LICENSE file that
    6.18 + * accompanied this code).
    6.19 + *
    6.20 + * You should have received a copy of the GNU General Public License version
    6.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    6.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.23 + *
    6.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    6.25 + * or visit www.oracle.com if you need additional information or have any
    6.26 + * questions.
    6.27 + */
    6.28 +
    6.29  package jdk.nashorn.internal.runtime;
    6.30  
    6.31  import java.util.AbstractList;
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/script/basic/JDK-8017768.js	Thu Jul 04 17:28:04 2013 +0200
     7.3 @@ -0,0 +1,35 @@
     7.4 +/*
     7.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.
    7.11 + *
    7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 + * version 2 for more details (a copy is included in the LICENSE file that
    7.16 + * accompanied this code).
    7.17 + *
    7.18 + * You should have received a copy of the GNU General Public License version
    7.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 + *
    7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 + * or visit www.oracle.com if you need additional information or have any
    7.24 + * questions.
    7.25 + */
    7.26 +
    7.27 +/**
    7.28 + * JDK-8017768: Allow use of dot notation for inner class names.
    7.29 + * 
    7.30 + * @test
    7.31 + * @run
    7.32 + */
    7.33 +
    7.34 +print(Java.type("java.awt.geom.Arc2D.Float") === Java.type("java.awt.geom.Arc2D$Float"))
    7.35 +var iisc = Java.type("jdk.nashorn.test.models.OuterClass$InnerStaticClass$InnerInnerStaticClass")
    7.36 +print(Java.type("jdk.nashorn.test.models.OuterClass.InnerStaticClass.InnerInnerStaticClass") === iisc)
    7.37 +print(Java.type("jdk.nashorn.test.models.OuterClass$InnerStaticClass.InnerInnerStaticClass") === iisc)
    7.38 +print(Java.type("jdk.nashorn.test.models.OuterClass.InnerStaticClass$InnerInnerStaticClass") === iisc)
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/test/script/basic/JDK-8017768.js.EXPECTED	Thu Jul 04 17:28:04 2013 +0200
     8.3 @@ -0,0 +1,4 @@
     8.4 +true
     8.5 +true
     8.6 +true
     8.7 +true
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/script/basic/JDK-8019809.js	Thu Jul 04 17:28:04 2013 +0200
     9.3 @@ -0,0 +1,37 @@
     9.4 +/*
     9.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + * 
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.
    9.11 + * 
    9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.15 + * version 2 for more details (a copy is included in the LICENSE file that
    9.16 + * accompanied this code).
    9.17 + * 
    9.18 + * You should have received a copy of the GNU General Public License version
    9.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.21 + * 
    9.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.23 + * or visit www.oracle.com if you need additional information or have any
    9.24 + * questions.
    9.25 + */
    9.26 +
    9.27 +/**
    9.28 + * JDK-8019809: Break return combo that generates erroneous bytecode
    9.29 + *
    9.30 + * @test
    9.31 + * @run
    9.32 + */
    9.33 +
    9.34 +//Function("L: {break L;return; }"); 
    9.35 +
    9.36 +function f() {
    9.37 +    L: { break L; return; }
    9.38 +}
    9.39 +
    9.40 +f();
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/test/script/basic/JDK-8019814.js	Thu Jul 04 17:28:04 2013 +0200
    10.3 @@ -0,0 +1,73 @@
    10.4 +/*
    10.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.7 + * 
    10.8 + * This code is free software; you can redistribute it and/or modify it
    10.9 + * under the terms of the GNU General Public License version 2 only, as
   10.10 + * published by the Free Software Foundation.
   10.11 + * 
   10.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   10.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.15 + * version 2 for more details (a copy is included in the LICENSE file that
   10.16 + * accompanied this code).
   10.17 + * 
   10.18 + * You should have received a copy of the GNU General Public License version
   10.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   10.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.21 + * 
   10.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   10.23 + * or visit www.oracle.com if you need additional information or have any
   10.24 + * questions.
   10.25 + */
   10.26 +
   10.27 +/**
   10.28 + * JDK-8019814: Add regression test for passing cases
   10.29 + *
   10.30 + * @test
   10.31 + * @run
   10.32 + */
   10.33 +
   10.34 +// java.lang.VerifyError: Bad type on operand stack
   10.35 +Function("switch([]) { case 7: }");
   10.36 +
   10.37 +// java.lang.AssertionError: expecting integer type or object for jump, but found double
   10.38 +Function("with(\nnull == (this % {}))( /x/g );");
   10.39 +
   10.40 +// java.lang.AssertionError: expecting equivalent types on stack but got double and int 
   10.41 +try {
   10.42 +    eval('Function("/*infloop*/while(((function ()4.)([z1,,], [,,]) - true++))switch(1e+81.x) { default: break; \u0009 }")');
   10.43 +} catch (e) {
   10.44 +    print(e.toString().replace(/\\/g, '/'));
   10.45 +}
   10.46 +
   10.47 +// java.lang.VerifyError: get long/double overflows locals
   10.48 +Function("var x = x -= '' ");
   10.49 +
   10.50 +// java.lang.AssertionError: object is not compatible with boolean
   10.51 +Function("return (null != [,,] <= this);");
   10.52 +
   10.53 +// java.lang.AssertionError: Only return value on stack allowed at return point
   10.54 +// - depth=2 stack = jdk.nashorn.internal.codegen.Label$Stack@4bd0d62f 
   10.55 +Function("x = 0.1, x\ntrue\n~this");
   10.56 +
   10.57 +// java.lang.AssertionError: node NaN ~ window class jdk.nashorn.internal.ir.BinaryNode
   10.58 +// has no symbol! [object] function _L1() 
   10.59 +Function("throw NaN\n~window;");
   10.60 +
   10.61 +// java.lang.AssertionError: array element type doesn't match array type
   10.62 +Function("if(([(this >>> 4.)].map(gc))) x;");
   10.63 +
   10.64 +try {
   10.65 +    eval('Function("if(--) y;")');
   10.66 +} catch (e) {
   10.67 +    print(e.toString().replace(/\\/g, '/'));
   10.68 +}
   10.69 +
   10.70 +// java.lang.AssertionError: stacks jdk.nashorn.internal.codegen.Label$Stack@4918f90f
   10.71 +// is not equivalent with jdk.nashorn.internal.codegen.Label$Stack@5f9b21a1 at join point 
   10.72 +Function("if((null ^ [1]) !== (this.yoyo(false))) {var NaN, x;x\n~[,,z1] }");
   10.73 +
   10.74 +// java.lang.AssertionError
   10.75 +//    at jdk.nashorn.internal.codegen.Attr.enterFunctionBody(Attr.java:276) 
   10.76 +Function("return (void ({ set each (x2)y }));"); 
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/test/script/basic/JDK-8019814.js.EXPECTED	Thu Jul 04 17:28:04 2013 +0200
    11.3 @@ -0,0 +1,6 @@
    11.4 +ReferenceError: <function>:1:50 Invalid left hand side for assignment
    11.5 +/*infloop*/while(((function ()4.)([z1,,], [,,]) - true++))switch(1e+81.x) { default: break; 	 }
    11.6 +                                                  ^
    11.7 +SyntaxError: <function>:1:5 Expected l-value but found )
    11.8 +if(--) y;
    11.9 +     ^
    12.1 --- a/test/script/currently-failing/JDK-8019809.js	Thu Jul 04 17:27:33 2013 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,37 +0,0 @@
    12.4 -/*
    12.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    12.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.7 - * 
    12.8 - * This code is free software; you can redistribute it and/or modify it
    12.9 - * under the terms of the GNU General Public License version 2 only, as
   12.10 - * published by the Free Software Foundation.
   12.11 - * 
   12.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   12.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.15 - * version 2 for more details (a copy is included in the LICENSE file that
   12.16 - * accompanied this code).
   12.17 - * 
   12.18 - * You should have received a copy of the GNU General Public License version
   12.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   12.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.21 - * 
   12.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.23 - * or visit www.oracle.com if you need additional information or have any
   12.24 - * questions.
   12.25 - */
   12.26 -
   12.27 -/**
   12.28 - * JDK-8019809: Break return combo that generates erroneous bytecode
   12.29 - *
   12.30 - * @test
   12.31 - * @run
   12.32 - */
   12.33 -
   12.34 -//Function("L: {break L;return; }"); 
   12.35 -
   12.36 -function f() {
   12.37 -    L: { break L; return; }
   12.38 -}
   12.39 -
   12.40 -f();
    13.1 --- a/test/src/jdk/nashorn/test/models/OuterClass.java	Thu Jul 04 17:27:33 2013 +0200
    13.2 +++ b/test/src/jdk/nashorn/test/models/OuterClass.java	Thu Jul 04 17:28:04 2013 +0200
    13.3 @@ -33,6 +33,10 @@
    13.4      }
    13.5  
    13.6      public static class InnerStaticClass {
    13.7 +
    13.8 +        public static class InnerInnerStaticClass {
    13.9 +        }
   13.10 +
   13.11          private final String value;
   13.12  
   13.13          public InnerStaticClass(String value) {

mercurial