OpenJDK / amber / amber
changeset 47337:89ff56cf0a2d lvti
Automatic merge with default
author | mcimadamore |
---|---|
date | Thu, 28 Sep 2017 22:15:46 +0200 |
parents | bc55f69eed06 8eb5e3ccee56 |
children | 7ff79f8d6b57 |
files | test/nashorn/script/currently-failing/JDK-8055034.js test/nashorn/script/currently-failing/JDK-8055034.js.EXPECTED |
diffstat | 78 files changed, 2344 insertions(+), 401 deletions(-) [+] |
line wrap: on
line diff
--- a/make/BuildNashorn.gmk Wed Sep 27 12:57:41 2017 +0100 +++ b/make/BuildNashorn.gmk Thu Sep 28 22:15:46 2017 +0200 @@ -41,7 +41,7 @@ $(eval $(call SetupJavaCompiler, GENERATE_NEWBYTECODE_DEBUG, \ JVM := $(JAVA_JAVAC), \ JAVAC := $(NEW_JAVAC), \ - FLAGS := -g -source 9 -target 9 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \ + FLAGS := -g -source 10 -target 10 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \ --system none --module-source-path $(call GetModuleSrcPath), \ SERVER_DIR := $(SJAVAC_SERVER_DIR), \ SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java Wed Sep 27 12:57:41 2017 +0100 +++ b/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java Thu Sep 28 22:15:46 2017 +0200 @@ -57,8 +57,8 @@ } JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - List<String> options = Arrays.asList("-source", "9", - "-target", "9", + List<String> options = Arrays.asList("-source", "10", + "-target", "10", "-proc:only", "--system", "none", "--module-source-path", args[0],
--- a/make/nashorn/build.xml Wed Sep 27 12:57:41 2017 +0100 +++ b/make/nashorn/build.xml Thu Sep 28 22:15:46 2017 +0200 @@ -174,8 +174,6 @@ <target name="compile" depends="prepare" description="Compiles nashorn"> <javac srcdir="${dynalink.module.src.dir}" destdir="${dynalink.module.classes.dir}" - source="${javac.source}" - target="${javac.target}" debug="${javac.debug}" encoding="${javac.encoding}" includeantruntime="false" fork="true"> @@ -190,8 +188,6 @@ </delete> <javac srcdir="${nashorn.module.src.dir}" destdir="${nashorn.module.classes.dir}" - source="${javac.source}" - target="${javac.target}" debug="${javac.debug}" encoding="${javac.encoding}" includeantruntime="false" fork="true"> @@ -207,8 +203,6 @@ </delete> <javac srcdir="${nashorn.shell.module.src.dir}" destdir="${nashorn.shell.module.classes.dir}" - source="${javac.source}" - target="${javac.target}" debug="${javac.debug}" encoding="${javac.encoding}" includeantruntime="false" fork="true"> @@ -342,8 +336,6 @@ <javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" - source="${javac.source}" - target="${javac.target}" debug="${javac.debug}" encoding="${javac.encoding}" includeantruntime="false" fork="true"> @@ -351,7 +343,7 @@ <compilerarg value="-Xlint:unchecked"/> <compilerarg value="-Xlint:deprecation"/> <compilerarg value="-Xdiags:verbose"/> - <compilerarg line="${test.module.imports}"/> + <compilerarg line="${test.module.imports.compile.time}"/> </javac> <copy todir="${build.test.classes.dir}/META-INF/services">
--- a/make/nashorn/buildtools/nasgen/project.properties Wed Sep 27 12:57:41 2017 +0100 +++ b/make/nashorn/buildtools/nasgen/project.properties Thu Sep 28 22:15:46 2017 +0200 @@ -24,8 +24,6 @@ # source and target levels build.compiler=modern -javac.source=1.7 -javac.target=1.7 # This directory is removed when the project is cleaned: nasgen.build.dir=../../../../build/nashorn/nasgen
--- a/make/nashorn/buildtools/nashorntask/project.properties Wed Sep 27 12:57:41 2017 +0100 +++ b/make/nashorn/buildtools/nashorntask/project.properties Thu Sep 28 22:15:46 2017 +0200 @@ -24,8 +24,6 @@ # source and target levels build.compiler=modern -javac.source=1.8 -javac.target=1.8 # This directory is removed when the project is cleaned: nashorntask.build.dir=../../../../build/nashorn/nashorntask
--- a/make/nashorn/project.properties Wed Sep 27 12:57:41 2017 +0100 +++ b/make/nashorn/project.properties Thu Sep 28 22:15:46 2017 +0200 @@ -32,8 +32,6 @@ # source and target levels build.compiler=modern -javac.source=1.9 -javac.target=1.9 javadoc.option=\ -tag "implSpec:a:Implementation Requirements:" \ @@ -146,7 +144,7 @@ ${file.reference.bsh.jar}${path.separator}\ ${file.reference.snakeyaml.jar} -test.module.imports=\ +test.module.imports.compile.time=\ --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.ir=ALL-UNNAMED \ --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.codegen=ALL-UNNAMED \ --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.parser=ALL-UNNAMED \ @@ -159,7 +157,10 @@ --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.regexp=ALL-UNNAMED \ --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.regexp.joni=ALL-UNNAMED \ --add-exports jdk.scripting.nashorn/jdk.nashorn.tools=ALL-UNNAMED \ - --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \ + --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED + +test.module.imports.runtime=\ + ${test.module.imports.compile.time} \ --add-opens jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED \ --add-opens jdk.scripting.nashorn/jdk.nashorn.internal.runtime.doubleconv=ALL-UNNAMED @@ -359,7 +360,7 @@ run.test.jvmargs.common=\ -server \ - ${test.module.imports} \ + ${test.module.imports.runtime} \ ${run.test.jvmargs.external} \ --add-modules jdk.scripting.nashorn.shell \ ${nashorn.override.option} \
--- a/src/java.base/share/classes/java/lang/ClassLoader.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.base/share/classes/java/lang/ClassLoader.java Thu Sep 28 22:15:46 2017 +0200 @@ -2160,10 +2160,12 @@ * if a package of the given {@code name} is already * defined by this class loader * + * * @since 1.2 * @revised 9 * @spec JPMS * + * @jvms 5.3 Run-time package * @see <a href="{@docRoot}/../specs/jar/jar.html#sealing"> * The JAR File Specification: Package Sealing</a> */ @@ -2186,17 +2188,19 @@ } /** - * Returns a {@code Package} of the given <a href="#name">name</a> that has been - * defined by this class loader. + * Returns a {@code Package} of the given <a href="#name">name</a> that + * has been defined by this class loader. * * @param name The <a href="#name">package name</a> * - * @return The {@code Package} of the given name defined by this class loader, - * or {@code null} if not found + * @return The {@code Package} of the given name that has been defined + * by this class loader, or {@code null} if not found * * @throws NullPointerException * if {@code name} is {@code null}. * + * @jvms 5.3 Run-time package + * * @since 9 * @spec JPMS */ @@ -2211,14 +2215,18 @@ } /** - * Returns all of the {@code Package}s defined by this class loader. - * The returned array has no duplicated {@code Package}s of the same name. + * Returns all of the {@code Package}s that have been defined by + * this class loader. The returned array has no duplicated {@code Package}s + * of the same name. * * @apiNote This method returns an array rather than a {@code Set} or {@code Stream} * for consistency with the existing {@link #getPackages} method. * - * @return The array of {@code Package} objects defined by this class loader; - * or an zero length array if no package has been defined by this class loader. + * @return The array of {@code Package} objects that have been defined by + * this class loader; or an zero length array if no package has been + * defined by this class loader. + * + * @jvms 5.3 Run-time package * * @since 9 * @spec JPMS @@ -2244,7 +2252,7 @@ * @param name * The <a href="#name">package name</a> * - * @return The {@code Package} corresponding to the given name defined by + * @return The {@code Package} of the given name that has been defined by * this class loader or its ancestors, or {@code null} if not found. * * @throws NullPointerException @@ -2263,6 +2271,8 @@ * {@link ClassLoader#getDefinedPackage} method which returns * a {@code Package} for the specified class loader. * + * @see ClassLoader#getDefinedPackage(String) + * * @since 1.2 * @revised 9 * @spec JPMS @@ -2281,10 +2291,10 @@ } /** - * Returns all of the {@code Package}s defined by this class loader - * and its ancestors. The returned array may contain more than one - * {@code Package} object of the same package name, each defined by - * a different class loader in the class loader hierarchy. + * Returns all of the {@code Package}s that have been defined by + * this class loader and its ancestors. The returned array may contain + * more than one {@code Package} object of the same package name, each + * defined by a different class loader in the class loader hierarchy. * * @apiNote The {@link #getPlatformClassLoader() platform class loader} * may delegate to the application class loader. In other words, @@ -2294,8 +2304,10 @@ * when invoked on the platform class loader, this method will not * return any packages defined to the application class loader. * - * @return The array of {@code Package} objects defined by this - * class loader and its ancestors + * @return The array of {@code Package} objects that have been defined by + * this class loader and its ancestors + * + * @see ClassLoader#getDefinedPackages() * * @since 1.2 * @revised 9
--- a/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java Thu Sep 28 22:15:46 2017 +0200 @@ -28,6 +28,7 @@ import java.util.Arrays; import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.LambdaForm.Kind.*; +import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeVirtual; import static java.lang.invoke.MethodHandleStatics.*; /** @@ -158,8 +159,11 @@ static final NamedFunction NF_getTarget; static { try { - NF_getTarget = new NamedFunction(DelegatingMethodHandle.class - .getDeclaredMethod("getTarget")); + MemberName member = new MemberName(DelegatingMethodHandle.class, "getTarget", + MethodType.methodType(MethodHandle.class), REF_invokeVirtual); + NF_getTarget = new NamedFunction( + MemberName.getFactory() + .resolveOrFail(REF_invokeVirtual, member, DelegatingMethodHandle.class, NoSuchMethodException.class)); } catch (ReflectiveOperationException ex) { throw newInternalError(ex); }
--- a/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Thu Sep 28 22:15:46 2017 +0200 @@ -753,42 +753,38 @@ return nf; } + private static final MethodType OBJ_OBJ_TYPE = MethodType.methodType(Object.class, Object.class); + + private static final MethodType LONG_OBJ_TYPE = MethodType.methodType(long.class, Object.class); + private static NamedFunction createFunction(byte func) { try { switch (func) { case NF_internalMemberName: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("internalMemberName", Object.class)); + return getNamedFunction("internalMemberName", OBJ_OBJ_TYPE); case NF_internalMemberNameEnsureInit: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("internalMemberNameEnsureInit", Object.class)); + return getNamedFunction("internalMemberNameEnsureInit", OBJ_OBJ_TYPE); case NF_ensureInitialized: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("ensureInitialized", Object.class)); + return getNamedFunction("ensureInitialized", MethodType.methodType(void.class, Object.class)); case NF_fieldOffset: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("fieldOffset", Object.class)); + return getNamedFunction("fieldOffset", LONG_OBJ_TYPE); case NF_checkBase: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("checkBase", Object.class)); + return getNamedFunction("checkBase", OBJ_OBJ_TYPE); case NF_staticBase: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("staticBase", Object.class)); + return getNamedFunction("staticBase", OBJ_OBJ_TYPE); case NF_staticOffset: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("staticOffset", Object.class)); + return getNamedFunction("staticOffset", LONG_OBJ_TYPE); case NF_checkCast: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("checkCast", Object.class, Object.class)); + return getNamedFunction("checkCast", MethodType.methodType(Object.class, Object.class, Object.class)); case NF_allocateInstance: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("allocateInstance", Object.class)); + return getNamedFunction("allocateInstance", OBJ_OBJ_TYPE); case NF_constructorMethod: - return new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("constructorMethod", Object.class)); + return getNamedFunction("constructorMethod", OBJ_OBJ_TYPE); case NF_UNSAFE: - return new NamedFunction(new MemberName(MethodHandleStatics.class - .getDeclaredField("UNSAFE"))); + MemberName member = new MemberName(MethodHandleStatics.class, "UNSAFE", Unsafe.class, REF_getField); + return new NamedFunction( + MemberName.getFactory() + .resolveOrFail(REF_getField, member, DirectMethodHandle.class, NoSuchMethodException.class)); default: throw newInternalError("Unknown function: " + func); } @@ -797,6 +793,15 @@ } } + private static NamedFunction getNamedFunction(String name, MethodType type) + throws ReflectiveOperationException + { + MemberName member = new MemberName(DirectMethodHandle.class, name, type, REF_invokeStatic); + return new NamedFunction( + MemberName.getFactory() + .resolveOrFail(REF_invokeStatic, member, DirectMethodHandle.class, NoSuchMethodException.class)); + } + static { // The Holder class will contain pre-generated DirectMethodHandles resolved // speculatively using MemberName.getFactory().resolveOrNull. However, that
--- a/src/java.base/share/classes/java/lang/invoke/Invokers.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.base/share/classes/java/lang/invoke/Invokers.java Thu Sep 28 22:15:46 2017 +0200 @@ -611,23 +611,17 @@ try { switch (func) { case NF_checkExactType: - return new NamedFunction(Invokers.class - .getDeclaredMethod("checkExactType", MethodHandle.class, MethodType.class)); + return getNamedFunction("checkExactType", MethodType.methodType(void.class, MethodHandle.class, MethodType.class)); case NF_checkGenericType: - return new NamedFunction(Invokers.class - .getDeclaredMethod("checkGenericType", MethodHandle.class, MethodType.class)); + return getNamedFunction("checkGenericType", MethodType.methodType(MethodHandle.class, MethodHandle.class, MethodType.class)); case NF_getCallSiteTarget: - return new NamedFunction(Invokers.class - .getDeclaredMethod("getCallSiteTarget", CallSite.class)); + return getNamedFunction("getCallSiteTarget", MethodType.methodType(MethodHandle.class, CallSite.class)); case NF_checkCustomized: - return new NamedFunction(Invokers.class - .getDeclaredMethod("checkCustomized", MethodHandle.class)); + return getNamedFunction("checkCustomized", MethodType.methodType(void.class, MethodHandle.class)); case NF_checkVarHandleGenericType: - return new NamedFunction(Invokers.class - .getDeclaredMethod("checkVarHandleGenericType", VarHandle.class, VarHandle.AccessDescriptor.class)); + return getNamedFunction("checkVarHandleGenericType", MethodType.methodType(MethodHandle.class, VarHandle.class, VarHandle.AccessDescriptor.class)); case NF_checkVarHandleExactType: - return new NamedFunction(Invokers.class - .getDeclaredMethod("checkVarHandleExactType", VarHandle.class, VarHandle.AccessDescriptor.class)); + return getNamedFunction("checkVarHandleExactType", MethodType.methodType(MethodHandle.class, VarHandle.class, VarHandle.AccessDescriptor.class)); default: throw newInternalError("Unknown function: " + func); } @@ -636,6 +630,15 @@ } } + private static NamedFunction getNamedFunction(String name, MethodType type) + throws ReflectiveOperationException + { + MemberName member = new MemberName(Invokers.class, name, type, REF_invokeStatic); + return new NamedFunction( + MemberName.getFactory() + .resolveOrFail(REF_invokeStatic, member, Invokers.class, NoSuchMethodException.class)); + } + private static class Lazy { private static final MethodHandle MH_asSpreader;
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Thu Sep 28 22:15:46 2017 +0200 @@ -1802,7 +1802,12 @@ try { readRecord(true); } catch (SocketTimeoutException e) { - // if time out, ignore the exception and continue + if ((debug != null) && Debug.isOn("ssl")) { + System.out.println( + Thread.currentThread().getName() + + ", received Exception: " + e); + } + fatal((byte)(-1), "Did not receive close_notify from peer", e); } } } catch (IOException e) {
--- a/src/java.base/share/classes/sun/security/util/ManifestDigester.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.base/share/classes/sun/security/util/ManifestDigester.java Thu Sep 28 22:15:46 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -28,6 +28,7 @@ import java.security.*; import java.util.HashMap; import java.io.ByteArrayOutputStream; +import static java.nio.charset.StandardCharsets.UTF_8; /** * This class is used to compute digests on sections of the Manifest. @@ -112,8 +113,6 @@ rawBytes = bytes; entries = new HashMap<>(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - Position pos = new Position(); if (!findSection(0, pos)) @@ -131,50 +130,41 @@ if (len > 6) { if (isNameAttr(bytes, start)) { - StringBuilder nameBuf = new StringBuilder(sectionLen); + ByteArrayOutputStream nameBuf = new ByteArrayOutputStream(); + nameBuf.write(bytes, start+6, len-6); - try { - nameBuf.append( - new String(bytes, start+6, len-6, "UTF8")); + int i = start + len; + if ((i-start) < sectionLen) { + if (bytes[i] == '\r') { + i += 2; + } else { + i += 1; + } + } - int i = start + len; - if ((i-start) < sectionLen) { - if (bytes[i] == '\r') { - i += 2; - } else { - i += 1; - } + while ((i-start) < sectionLen) { + if (bytes[i++] == ' ') { + // name is wrapped + int wrapStart = i; + while (((i-start) < sectionLen) + && (bytes[i++] != '\n')); + if (bytes[i-1] != '\n') + return; // XXX: exception? + int wrapLen; + if (bytes[i-2] == '\r') + wrapLen = i-wrapStart-2; + else + wrapLen = i-wrapStart-1; + + nameBuf.write(bytes, wrapStart, wrapLen); + } else { + break; } + } - while ((i-start) < sectionLen) { - if (bytes[i++] == ' ') { - // name is wrapped - int wrapStart = i; - while (((i-start) < sectionLen) - && (bytes[i++] != '\n')); - if (bytes[i-1] != '\n') - return; // XXX: exception? - int wrapLen; - if (bytes[i-2] == '\r') - wrapLen = i-wrapStart-2; - else - wrapLen = i-wrapStart-1; - - nameBuf.append(new String(bytes, wrapStart, - wrapLen, "UTF8")); - } else { - break; - } - } - - entries.put(nameBuf.toString(), - new Entry(start, sectionLen, sectionLenWithBlank, + entries.put(new String(nameBuf.toByteArray(), UTF_8), + new Entry(start, sectionLen, sectionLenWithBlank, rawBytes)); - - } catch (java.io.UnsupportedEncodingException uee) { - throw new IllegalStateException( - "UTF8 not available on platform"); - } } } start = pos.startOfNext;
--- a/src/java.base/unix/native/libnet/PlainSocketImpl.c Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.base/unix/native/libnet/PlainSocketImpl.c Thu Sep 28 22:15:46 2017 +0200 @@ -679,14 +679,16 @@ } /* ECONNABORTED or EWOULDBLOCK error so adjust timeout if there is one. */ - currNanoTime = JVM_NanoTime(env, 0); - nanoTimeout -= (currNanoTime - prevNanoTime); - if (nanoTimeout < NET_NSEC_PER_MSEC) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException", - "Accept timed out"); - return; + if (nanoTimeout >= NET_NSEC_PER_MSEC) { + currNanoTime = JVM_NanoTime(env, 0); + nanoTimeout -= (currNanoTime - prevNanoTime); + if (nanoTimeout < NET_NSEC_PER_MSEC) { + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException", + "Accept timed out"); + return; + } + prevNanoTime = currNanoTime; } - prevNanoTime = currNanoTime; } if (newfd < 0) {
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Thu Sep 28 22:15:46 2017 +0200 @@ -216,8 +216,9 @@ * Character#isJavaIdentifierStart(int)} returns {@code true}, * followed only by characters for which {@link * Character#isJavaIdentifierPart(int)} returns {@code true}. - * This pattern matches regular identifiers, keywords, and the - * literals {@code "true"}, {@code "false"}, and {@code "null"}. + * This pattern matches regular identifiers, keywords, restricted + * keywords, and the literals {@code "true"}, {@code "false"}, and + * {@code "null"}. * The method returns {@code false} for all other strings. * * @param name the string to check @@ -251,10 +252,13 @@ * qualified name in the latest source version. Unlike {@link * #isIdentifier isIdentifier}, this method returns {@code false} * for keywords, boolean literals, and the null literal. + * This method returns {@code true} for <i>restricted + * keywords</i>. * * @param name the string to check * @return {@code true} if this string is a * syntactically valid name, {@code false} otherwise. + * @jls 3.9 Keywords * @jls 6.2 Names and Identifiers */ public static boolean isName(CharSequence name) { @@ -266,11 +270,14 @@ * qualified name in the given source version. Unlike {@link * #isIdentifier isIdentifier}, this method returns {@code false} * for keywords, boolean literals, and the null literal. + * This method returns {@code true} for <i>restricted + * keywords</i>. * * @param name the string to check * @param version the version to use * @return {@code true} if this string is a * syntactically valid name, {@code false} otherwise. + * @jls 3.9 Keywords * @jls 6.2 Names and Identifiers * @since 9 */ @@ -287,6 +294,8 @@ /** * Returns whether or not {@code s} is a keyword, boolean literal, * or null literal in the latest source version. + * This method returns {@code false} for <i>restricted + * keywords</i>. * * @param s the string to check * @return {@code true} if {@code s} is a keyword, or boolean @@ -302,6 +311,8 @@ /** * Returns whether or not {@code s} is a keyword, boolean literal, * or null literal in the given source version. + * This method returns {@code false} for <i>restricted + * keywords</i>. * * @param s the string to check * @param version the version to use
--- a/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Sep 28 22:15:46 2017 +0200 @@ -87,7 +87,7 @@ * * @return {@code true} if this is an open module and {@code * false} otherwise - */ // TODO: add @jls to unnamed module section + */ boolean isOpen(); /** @@ -96,7 +96,9 @@ * * @return {@code true} if this is an unnamed module and {@code * false} otherwise - */ // TODO: add @jls to unnamed module section + * + * @jls 7.7.5 Unnamed Modules + */ boolean isUnnamed(); /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java Thu Sep 28 22:15:46 2017 +0200 @@ -39,6 +39,7 @@ import javax.lang.model.type.TypeVariable; import javax.lang.model.util.SimpleTypeVisitor9; +import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; import jdk.javadoc.internal.doclets.toolkit.Content; @@ -199,55 +200,61 @@ */ protected void addParameters(ExecutableElement member, boolean includeAnnotations, Content htmltree, int indentSize) { - htmltree.addContent(Contents.ZERO_WIDTH_SPACE); - htmltree.addContent("("); + Content paramTree = new ContentBuilder(); String sep = ""; List<? extends VariableElement> parameters = member.getParameters(); CharSequence indent = makeSpace(indentSize + 1); TypeMirror rcvrType = member.getReceiverType(); if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) { List<? extends AnnotationMirror> annotationMirrors = rcvrType.getAnnotationMirrors(); - addReceiverAnnotations(member, rcvrType, annotationMirrors, htmltree); + addReceiverAnnotations(member, rcvrType, annotationMirrors, paramTree); sep = "," + DocletConstants.NL + indent; } int paramstart; for (paramstart = 0; paramstart < parameters.size(); paramstart++) { - htmltree.addContent(sep); + paramTree.addContent(sep); VariableElement param = parameters.get(paramstart); if (param.getKind() != ElementKind.INSTANCE_INIT) { if (includeAnnotations) { boolean foundAnnotations = writer.addAnnotationInfo(indent.length(), - member, param, htmltree); + member, param, paramTree); if (foundAnnotations) { - htmltree.addContent(DocletConstants.NL); - htmltree.addContent(indent); + paramTree.addContent(DocletConstants.NL); + paramTree.addContent(indent); } } addParam(member, param, - (paramstart == parameters.size() - 1) && member.isVarArgs(), htmltree); + (paramstart == parameters.size() - 1) && member.isVarArgs(), paramTree); break; } } for (int i = paramstart + 1; i < parameters.size(); i++) { - htmltree.addContent(","); - htmltree.addContent(DocletConstants.NL); - htmltree.addContent(indent); + paramTree.addContent(","); + paramTree.addContent(DocletConstants.NL); + paramTree.addContent(indent); if (includeAnnotations) { boolean foundAnnotations = writer.addAnnotationInfo(indent.length(), member, parameters.get(i), - htmltree); + paramTree); if (foundAnnotations) { - htmltree.addContent(DocletConstants.NL); - htmltree.addContent(indent); + paramTree.addContent(DocletConstants.NL); + paramTree.addContent(indent); } } addParam(member, parameters.get(i), (i == parameters.size() - 1) && member.isVarArgs(), - htmltree); + paramTree); } - htmltree.addContent(")"); + if (paramTree.isEmpty()) { + htmltree.addContent("()"); + } else { + htmltree.addContent(Contents.ZERO_WIDTH_SPACE); + htmltree.addContent("("); + htmltree.addContent(paramTree); + paramTree.addContent(")"); + } } /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Thu Sep 28 22:15:46 2017 +0200 @@ -364,7 +364,7 @@ List<? extends DocTree> tags; Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element)); HtmlTree div = new HtmlTree(HtmlTag.DIV); - div.addStyle(HtmlStyle.block); + div.addStyle(HtmlStyle.deprecationBlock); if (utils.isDeprecated(element)) { div.addContent(span); tags = utils.getBlockTags(element, DocTree.Kind.DEPRECATED);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Thu Sep 28 22:15:46 2017 +0200 @@ -355,7 +355,7 @@ writer.getTagletWriterInstance(false)); if (!output.isEmpty()) { Content deprecatedContent = output; - Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent); + Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprecatedContent); contentTree.addContent(div); } }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Sep 28 22:15:46 2017 +0200 @@ -278,7 +278,8 @@ */ @Override public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) { - annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR)); + Content hr = new HtmlTree(HtmlTag.HR); + annotationInfoTree.addContent(hr); Content pre = new HtmlTree(HtmlTag.PRE); addAnnotationInfo(annotationType, pre); pre.addContent(modifiers); @@ -324,13 +325,11 @@ */ @Override public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) { - Content hr = new HtmlTree(HtmlTag.HR); - annotationInfoTree.addContent(hr); List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED); if (utils.isDeprecated(annotationType)) { CommentHelper ch = utils.getCommentHelper(annotationType); Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(annotationType)); - Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel); + Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel); if (!deprs.isEmpty()) { List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Thu Sep 28 22:15:46 2017 +0200 @@ -293,7 +293,8 @@ */ @Override public void addClassSignature(String modifiers, Content classInfoTree) { - classInfoTree.addContent(new HtmlTree(HtmlTag.BR)); + Content hr = new HtmlTree(HtmlTag.HR); + classInfoTree.addContent(hr); Content pre = new HtmlTree(HtmlTag.PRE); addAnnotationInfo(typeElement, pre); pre.addContent(modifiers); @@ -606,12 +607,10 @@ */ @Override public void addClassDeprecationInfo(Content classInfoTree) { - Content hr = new HtmlTree(HtmlTag.HR); - classInfoTree.addContent(hr); List<? extends DocTree> deprs = utils.getBlockTags(typeElement, DocTree.Kind.DEPRECATED); if (utils.isDeprecated(typeElement)) { Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(typeElement)); - Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel); + Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel); if (!deprs.isEmpty()) { CommentHelper ch = utils.getCommentHelper(typeElement); DocTree dt = deprs.get(0);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Thu Sep 28 22:15:46 2017 +0200 @@ -929,7 +929,7 @@ if (utils.isDeprecated(mdle)) { CommentHelper ch = utils.getCommentHelper(mdle); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); - deprDiv.addStyle(HtmlStyle.deprecatedContent); + deprDiv.addStyle(HtmlStyle.deprecationBlock); Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle)); deprDiv.addContent(deprPhrase); if (!deprs.isEmpty()) { @@ -1064,7 +1064,7 @@ if (utils.isDeprecated(pkg)) { deprs = utils.getDeprecatedTrees(pkg); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); - deprDiv.addStyle(HtmlStyle.deprecatedContent); + deprDiv.addStyle(HtmlStyle.deprecationBlock); Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg)); deprDiv.addContent(deprPhrase); if (!deprs.isEmpty()) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Thu Sep 28 22:15:46 2017 +0200 @@ -171,7 +171,7 @@ if (utils.isDeprecated(packageElement)) { CommentHelper ch = utils.getCommentHelper(packageElement); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); - deprDiv.addStyle(HtmlStyle.deprecatedContent); + deprDiv.addStyle(HtmlStyle.deprecationBlock); Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement)); deprDiv.addContent(deprPhrase); if (!deprs.isEmpty()) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Thu Sep 28 22:15:46 2017 +0200 @@ -53,9 +53,9 @@ constantsSummary, constantValuesContainer, contentContainer, - deprecatedContent, deprecatedLabel, deprecatedSummary, + deprecationBlock, deprecationComment, description, descfrmTypeLabel,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java Thu Sep 28 22:15:46 2017 +0200 @@ -147,8 +147,8 @@ throws DocletException { Content annotationInfoTree = writer.getAnnotationInfoTreeHeader(); + buildAnnotationTypeSignature(annotationInfoTree); buildDeprecationInfo(annotationInfoTree); - buildAnnotationTypeSignature(annotationInfoTree); buildAnnotationTypeDescription(annotationInfoTree); buildAnnotationTypeTagInfo(annotationInfoTree);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java Thu Sep 28 22:15:46 2017 +0200 @@ -175,8 +175,8 @@ buildInterfaceUsageInfo(classInfoTree); buildNestedClassInfo(classInfoTree); buildFunctionalInterfaceInfo(classInfoTree); + buildClassSignature(classInfoTree); buildDeprecationInfo(classInfoTree); - buildClassSignature(classInfoTree); buildClassDescription(classInfoTree); buildClassTagInfo(classInfoTree);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Thu Sep 28 22:15:46 2017 +0200 @@ -645,6 +645,17 @@ .deprecationComment, .emphasizedPhrase, .interfaceName { font-style:italic; } +.deprecationBlock { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, div.block div.block span.interfaceName {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java Thu Sep 28 22:15:46 2017 +0200 @@ -273,7 +273,8 @@ private static final class LocalVariableTypeCalculationPhase extends CompilationPhase { @Override FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) { - final FunctionNode newFunctionNode = transformFunction(fn, new LocalVariableTypesCalculator(compiler)); + final FunctionNode newFunctionNode = transformFunction(fn, new LocalVariableTypesCalculator(compiler, + compiler.getReturnType())); final ScriptEnvironment senv = compiler.getScriptEnvironment(); final PrintWriter err = senv.getErr();
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Thu Sep 28 22:15:46 2017 +0200 @@ -619,6 +619,10 @@ return types == null ? null : types.get(fn, pos); } + Type getReturnType() { + return types == null || !isOnDemandCompilation() ? Type.UNKNOWN : types.getReturnType(); + } + /** * Do a compilation job *
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Thu Sep 28 22:15:46 2017 +0200 @@ -405,10 +405,15 @@ // variables). private final Deque<Label> catchLabels = new ArrayDeque<>(); - LocalVariableTypesCalculator(final Compiler compiler) { + private LocalVariableTypesCalculator(final Compiler compiler) { this.compiler = compiler; } + LocalVariableTypesCalculator(final Compiler compiler, final Type returnType) { + this(compiler); + this.returnType = returnType; + } + private JumpTarget createJumpTarget(final Label label) { assert !jumpTargets.containsKey(label); final JumpTarget jumpTarget = new JumpTarget();
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java Thu Sep 28 22:15:46 2017 +0200 @@ -117,6 +117,15 @@ return null; } + /** + * Get the return type required for the call site we're compiling for. This only determines + * whether object return type is required or not. + * @return Type.OBJECT for call sites with object return types, Type.UNKNOWN for everything else + */ + Type getReturnType() { + return returnType.isObject() ? Type.OBJECT : Type.UNKNOWN; + } + @Override public String toString() { return toString("");
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Thu Sep 28 22:15:46 2017 +0200 @@ -43,6 +43,7 @@ import jdk.dynalink.linker.support.TypeUtilities; import jdk.nashorn.api.scripting.JSObject; import jdk.nashorn.api.scripting.ScriptObjectMirror; +import jdk.nashorn.api.scripting.ScriptUtils; import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Function; import jdk.nashorn.internal.objects.annotations.ScriptClass; @@ -430,9 +431,9 @@ if (objArray == null) { return null; } else if (objArray instanceof Collection) { - return new NativeArray(((Collection<?>)objArray).toArray()); + return new NativeArray(ScriptUtils.unwrapArray(((Collection<?>)objArray).toArray())); } else if (objArray instanceof Object[]) { - return new NativeArray(((Object[])objArray).clone()); + return new NativeArray(ScriptUtils.unwrapArray(((Object[])objArray).clone())); } else if (objArray instanceof int[]) { return new NativeArray(((int[])objArray).clone()); } else if (objArray instanceof double[]) {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Thu Sep 28 22:15:46 2017 +0200 @@ -5109,8 +5109,13 @@ final LiteralNode<Expression[]> rawStringArray = LiteralNode.newInstance(templateToken, finish, rawStrings); final LiteralNode<Expression[]> cookedStringArray = LiteralNode.newInstance(templateToken, finish, cookedStrings); - final RuntimeNode templateObject = new RuntimeNode(templateToken, finish, RuntimeNode.Request.GET_TEMPLATE_OBJECT, rawStringArray, cookedStringArray); - argumentList.set(0, templateObject); + + if (!env._parse_only) { + final RuntimeNode templateObject = new RuntimeNode(templateToken, finish, RuntimeNode.Request.GET_TEMPLATE_OBJECT, rawStringArray, cookedStringArray); + argumentList.set(0, templateObject); + } else { + argumentList.set(0, rawStringArray); + } return optimizeList(argumentList); }
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java Wed Sep 27 12:57:41 2017 +0100 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java Thu Sep 28 22:15:46 2017 +0200 @@ -336,6 +336,7 @@ } } + @SuppressWarnings("try") protected void loadMeta() throws IOException { if (length == 0 && lastModified == 0) { final URLConnection c = url.openConnection();
--- a/src/sample/nashorn/autoimports.js Wed Sep 27 12:57:41 2017 +0100 +++ b/src/sample/nashorn/autoimports.js Thu Sep 28 22:15:46 2017 +0200 @@ -1,7 +1,7 @@ # autoimports script requires -scripting mode /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,6 +43,12 @@ * script, you can call autoimports to get the exact Java imports you need and replace * the autoimports load with the generated import statements (to avoid costly init of * the autoimports script). + * + * Example usage of autoimports.js in interactive mode: + * + * jjs -scripting autoimports.js - + * jjs> Vector + * jjs> [JavaClass java.util.Vector] */ (function() { @@ -99,8 +105,8 @@ Files.walk(root).forEach(function(p) { if (Files.isRegularFile(p)) { var str = p.toString(); - if (str.endsWith(".class")) { - str = str.substring(1); + if (str.endsWith(".class") && !str.endsWith("module-info.class")) { + str = str.substring("/modules/".length); var idx = str.indexOf('/'); if (idx != -1) { str = str.substring(idx + 1);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sample/nashorn/base64.js Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// Usage: jjs --language=es6 base64.js + +const Base64 = Java.type("java.util.Base64"); +const ByteArray = Java.type("byte[]"); +const JString = Java.type("java.lang.String"); + +function toBase64(s) { + const ba = s instanceof ByteArray? s : String(s).bytes; + return Base64.encoder.encodeToString(ba); +} + +function fromBase64(s) { + const ba = s instanceof ByteArray? s : String(s).bytes; + return new JString(Base64.decoder.decode(ba)); +} + +print(toBase64`hello world`); +print(fromBase64(toBase64`hello world`));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sample/nashorn/dom_tagged_literal.js Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This sample demonstrates the use of es6 tagged template literal to + * create a java object. A XML DOM Document object is created from + * String using es6 tagged template literal. + * + * Usage: + * jjs --language=es6 dom_tagged_literal.js + */ + +// Java types used +const BAIS = Java.type("java.io.ByteArrayInputStream") +const DocBuilderFac = Java.type("javax.xml.parsers.DocumentBuilderFactory") +const DOMSource = Java.type("javax.xml.transform.dom.DOMSource") +const StreamResult = Java.type("javax.xml.transform.stream.StreamResult") +const StringWriter = Java.type("java.io.StringWriter") +const TransformerFactory = Java.type("javax.xml.transform.TransformerFactory") + +function DOM(str) { + var docBuilder = DocBuilderFac.newInstance().newDocumentBuilder() + docBuilder.validating = false + return docBuilder["parse(java.io.InputStream)"](new BAIS(String(str).bytes)) +} + +// es6 tagged template literal to create DOM from +// multi-line XML string + +const dom = DOM` +<foo> + <bar title="hello">world</bar> +</foo>` + +// access DOM elements +const foo = dom.documentElement +print(foo.tagName) +const bar = foo.getElementsByTagName("bar").item(0) +print(bar.tagName) +print(bar.getAttribute("title")) + +// modify DOM +foo.setAttribute("name", "nashorn") +foo.appendChild(dom.createElement("test")) + +// serialize DOM to XML string +function domToXML(d) { + const transformer = TransformerFactory.newInstance().newTransformer() + const res = new StreamResult(new StringWriter()) + transformer.transform(new DOMSource(d), res) + return res.writer.toString() +} + +// serialize DOM to a String & print +print(domToXML(dom))
--- a/src/sample/nashorn/dynalink/README Wed Sep 27 12:57:41 2017 +0100 +++ b/src/sample/nashorn/dynalink/README Thu Sep 28 22:15:46 2017 +0200 @@ -4,12 +4,6 @@ "xyz_linker.js". These scripts build dynalink linker jar from java code and exec another jjs process with appropriate classpath set. -Note: you need to build jdk9 forest and put "images/jdk/bin" in your PATH to use -these scripts. This is because these scripts use javac to build dynalink jar and -exec another jjs with classpath set! Alternatively, you can also manually build -dynalink linker jars and invoke sample scripts by putting linker jar in jjs tool's -classpath as well. - Dynalink samples: * array_stream_linker.js
--- a/src/sample/nashorn/dynalink/array_stream_linker.js Wed Sep 27 12:57:41 2017 +0100 +++ b/src/sample/nashorn/dynalink/array_stream_linker.js Thu Sep 28 22:15:46 2017 +0200 @@ -1,7 +1,7 @@ #! array stream linker example /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,10 +37,12 @@ $EXEC.throwOnError=true // compile ArrayStreamLinkerExporter -`javac -cp ../../dist/nashorn.jar ArrayStreamLinkerExporter.java` +`javac ArrayStreamLinkerExporter.java` + +load("jarutil.js"); // make a jar file out of pluggable linker -`jar cvf array_stream_linker.jar ArrayStreamLinkerExporter*.class META-INF/` +makeJar("array_stream_linker.jar"); // run a sample script that uses pluggable linker // but make sure classpath points to the pluggable linker jar!
--- a/src/sample/nashorn/dynalink/buffer_indexing_linker.js Wed Sep 27 12:57:41 2017 +0100 +++ b/src/sample/nashorn/dynalink/buffer_indexing_linker.js Thu Sep 28 22:15:46 2017 +0200 @@ -1,7 +1,7 @@ # buffer indexing linker example /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,10 +37,12 @@ $EXEC.throwOnError=true // compile BufferIndexingLinkerExporter -`javac -cp ../../dist/nashorn.jar BufferIndexingLinkerExporter.java` +`javac BufferIndexingLinkerExporter.java` + +load("jarutil.js"); // make a jar file out of pluggable linker -`jar cvf buffer_indexing_linker.jar BufferIndexingLinkerExporter*.class META-INF/` +makeJar("buffer_indexing_linker.jar"); // run a sample script that uses pluggable linker // but make sure classpath points to the pluggable linker jar!
--- a/src/sample/nashorn/dynalink/dom_linker.js Wed Sep 27 12:57:41 2017 +0100 +++ b/src/sample/nashorn/dynalink/dom_linker.js Thu Sep 28 22:15:46 2017 +0200 @@ -37,10 +37,12 @@ $EXEC.throwOnError=true // compile DOMLinkerExporter -`javac -cp ../../dist/nashorn.jar DOMLinkerExporter.java` +`javac DOMLinkerExporter.java` + +load("jarutil.js"); // make a jar file out of pluggable linker -`jar cvf dom_linker.jar DOMLinkerExporter*.class META-INF/` +makeJar("dom_linker.jar"); // run a sample script that uses pluggable linker // but make sure classpath points to the pluggable linker jar!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sample/nashorn/dynalink/jarutil.js Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +function classFiles() { + var arr = new java.io.File(".").listFiles( + new java.io.FilenameFilter() { + accept: function(dir, str) str.endsWith(".class") + }); + var str = ""; + for (var i in arr) str += " " + arr[i]; + return str; +} + +function makeJar(name) { + $EXEC("jar cvf " + name + " META-INF/ " + classFiles()); + print($ERR); +}
--- a/src/sample/nashorn/dynalink/missing_method_linker.js Wed Sep 27 12:57:41 2017 +0100 +++ b/src/sample/nashorn/dynalink/missing_method_linker.js Thu Sep 28 22:15:46 2017 +0200 @@ -1,7 +1,7 @@ #! missing method linker example /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,10 +37,12 @@ $EXEC.throwOnError=true // compile MissingMethodLinkerExporter -`javac -cp ../../dist/nashorn.jar MissingMethodLinkerExporter.java MissingMethodHandler.java MissingMethodExample.java` +`javac MissingMethodLinkerExporter.java MissingMethodHandler.java MissingMethodExample.java` + +load("jarutil.js"); // make a jar file out of pluggable linker -`jar cvf missing_method_linker.jar MissingMethod*.class META-INF/` +makeJar("missing_method_linker.jar"); // run a sample script that uses pluggable linker // but make sure classpath points to the pluggable linker jar!
--- a/src/sample/nashorn/dynalink/underscore_linker.js Wed Sep 27 12:57:41 2017 +0100 +++ b/src/sample/nashorn/dynalink/underscore_linker.js Thu Sep 28 22:15:46 2017 +0200 @@ -1,7 +1,7 @@ # underscore name translator dynalink linker example /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,10 +37,12 @@ $EXEC.throwOnError=true // compile UnderscoreNameLinkerExporter -`javac -cp ../../dist/nashorn.jar UnderscoreNameLinkerExporter.java` +`javac UnderscoreNameLinkerExporter.java` + +load('jarutil.js'); // make a jar file out of pluggable linker -`jar cvf underscore_linker.jar UnderscoreNameLinkerExporter*.class META-INF/` +makeJar("underscore_linker.jar"); // run a sample script that uses pluggable linker // but make sure classpath points to the pluggable linker jar!
--- a/test/TestCommon.gmk Wed Sep 27 12:57:41 2017 +0100 +++ b/test/TestCommon.gmk Thu Sep 28 22:15:46 2017 +0200 @@ -273,7 +273,7 @@ prep: @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) @$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` - @if [ ! -d $(TEST_ROOT)/../.hg ] ; then \ + @if [ ! -d $(TEST_ROOT)/../../.hg ] && [ ! -d $(TEST_ROOT)/../../../.hg ]; then \ $(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \) \ -exec $(CHMOD) a+rx {} \; ; \ fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/lang/invoke/InvokeWithArgumentsTest.java Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2017, 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. + */ + +/* @test + * @summary basic tests for MethodHandle.invokeWithArguments + * @run testng test.java.lang.invoke.InvokeWithArgumentsTest + */ + +package test.java.lang.invoke; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.WrongMethodTypeException; + +import static java.lang.invoke.MethodType.methodType; + +public class InvokeWithArgumentsTest { + static final MethodHandles.Lookup L = MethodHandles.lookup(); + + static Object[] arity(Object o1, Object o2, Object... a) { + return a; + } + + @Test + public void testArity() throws Throwable { + MethodHandle mh = L.findStatic(L.lookupClass(), "arity", + methodType(Object[].class, Object.class, Object.class, Object[].class)); + + try { + mh.invokeWithArguments(""); + Assert.fail("WrongMethodTypeException expected"); + } catch (WrongMethodTypeException e) {} + } + + static Object[] passThrough(String... a) { + return a; + } + + static Object[] pack(Object o, Object... a) { + return a; + } + + @Test + public void testArrayNoPassThrough() throws Throwable { + String[] actual = {"A", "B"}; + + MethodHandle mh = L.findStatic(L.lookupClass(), "passThrough", + methodType(Object[].class, String[].class)); + + // Note: the actual array is not preserved, the elements will be + // unpacked and then packed into a new array before invoking the method + String[] expected = (String[]) mh.invokeWithArguments(actual); + + Assert.assertTrue(actual != expected, "Array should not pass through"); + Assert.assertEquals(actual, expected, "Array contents should be equal"); + } + + @Test + public void testArrayPack() throws Throwable { + String[] actual = new String[]{"A", "B"}; + + MethodHandle mh = L.findStatic(L.lookupClass(), "pack", + methodType(Object[].class, Object.class, Object[].class)); + + // Note: since String[] can be cast to Object, the actual String[] array + // will cast to Object become the single element of a new Object[] array + Object[] expected = (Object[]) mh.invokeWithArguments("", actual); + + Assert.assertEquals(1, expected.length, "Array should contain just one element"); + Assert.assertTrue(actual == expected[0], "Array should pass through"); + } + + static void intArray(int... a) { + } + + @Test + public void testPrimitiveArrayWithNull() throws Throwable { + MethodHandle mh = L.findStatic(L.lookupClass(), "intArray", + methodType(void.class, int[].class)); + try { + mh.invokeWithArguments(null, null); + Assert.fail("NullPointerException expected"); + } catch (NullPointerException e) {} + } + + @Test + public void testPrimitiveArrayWithRef() throws Throwable { + MethodHandle mh = L.findStatic(L.lookupClass(), "intArray", + methodType(void.class, int[].class)); + try { + mh.invokeWithArguments("A", "B"); + Assert.fail("ClassCastException expected"); + } catch (ClassCastException e) {} + } + + + static void numberArray(Number... a) { + } + + @Test + public void testRefArrayWithCast() throws Throwable { + MethodHandle mh = L.findStatic(L.lookupClass(), "numberArray", + methodType(void.class, Number[].class)); + // All numbers, should not throw + mh.invokeWithArguments(1, 1.0, 1.0F, 1L); + + try { + mh.invokeWithArguments("A"); + Assert.fail("ClassCastException expected"); + } catch (ClassCastException e) {} + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/net/HugeDataTransferTest.java Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,881 @@ +/* + * Copyright (c) 2017, 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. + */ + +/** + * @test + * @bug 8185072 + * @summary network006 times out in many configs in JDK10-hs nightly + * @run main/othervm/manual HugeDataTransferTest 1 + */ +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.UnknownHostException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Random; + +/** + * This test makes huge number of data transfers between 2 Java virtual machines + * using the TCP/IP protocol, and checks if those data are transfered correctly. + * Both client and server VMs run on the same local computer and attach TCP/IP + * sockets to the local host, or to the loopback domain + * ``<code>localhost</code>'' (having IP address <code>127.0.0.1</code>). + * + * <p> + * In this test, 128 client/server connections are established. Once a + * connection is established, client passes a data parcel to server, and server + * reads that parcel and checks if it is same as expected (byte-to-byte equality + * is desired). Then server passes (some other) parcel to the client, and client + * reads and verifies those bytes. This ping-pong game is repeated 128 times; + * and after that each pair of sockets checks if there are no extra bytes + * accedentally passed through their connection. + * + * <p> + * Parcels lengths and contents are chosen randomly, and average parcel length + * is 128 bytes. So totally, each pair of sockets passes ~16Kb of data to each + * other, and thus ~32Kb of data are transfered by each sockets pair. Totally, + * ~4Mb of data are transfered by all client/server pairs. + * + * @author vtewari + */ +public class HugeDataTransferTest { + + /** + * Timeout for TCP/IP sockets (currently set to 1 min). + */ + private static int SO_TIMEOUT;// = 2*60*1000; + + /** + * Maximal number of connections this test should open simultaneously. + */ + private final static int MAX_CONNECTIONS = 128; + + /** + * Check few more connections to make sure that MAX_CONNECTIONS are safe. + */ + private final static int CONNECTIONS_RESERVE = 10; + + /** + * The test used to fail with connection reset by peer set to 50. (and once + * in a three if it was set to 10). So now we set it to MAX_CONNECTIONS + * (128). + */ + private final static int BACKLOG_QUEUE_LENGTH = MAX_CONNECTIONS; + + /** + * Number of parcels to be sent/recieved. + */ + private final static int DATA_PARCELS = 128; + + /** + * Maximal length of data parcel to be sent/recieved (it equals to 256 bytes + * now). + */ + private final static int MAX_PARCEL = 1 << 8; + + /** + * Either actually display optional reports or not. + */ + static private final boolean DEBUG_MODE = false; + + /** + * How many IP sockets can we open simultaneously? Check if + * <code>MAX_CONNECTIONS</code> connections can be open simultaneously. + */ + private static int detectOSLimitation() { + final int CONNECTIONS_TO_TRY = MAX_CONNECTIONS + CONNECTIONS_RESERVE; + display("--- Trying to open " + CONNECTIONS_TO_TRY + " connections:"); + + InetAddress address; + ServerSocket serverSocket; + try { + address = InetAddress.getLocalHost(); + int anyPort = 0; + int defaultBacklog = BACKLOG_QUEUE_LENGTH; + serverSocket = new ServerSocket(anyPort, defaultBacklog, address); + } catch (IOException ioe) { + throw new Error("FATAL error while loading the test: " + ioe); + } + display(serverSocket.toString()); + + Socket server[] = new Socket[CONNECTIONS_TO_TRY]; + Socket client[] = new Socket[CONNECTIONS_TO_TRY]; + + int i, port = serverSocket.getLocalPort(); + for (i = 0; i < CONNECTIONS_TO_TRY; i++) { + try { + client[i] = new Socket(address, port); + display(">Open: client[" + i + "] = " + client[i]); + server[i] = serverSocket.accept(); + display(">Open: server[" + i + "] = " + server[i]); + } catch (IOException ioe) { + display(">OOPS! -- failed to open connection #" + i); + break; + } + } + display("> Could open " + + (i < CONNECTIONS_TO_TRY ? "only " : "") + i + " connections."); + display(">Closing them:"); + for (int j = 0; j < i; j++) { + try { + server[j].close(); + client[j].close(); + } catch (IOException ioe) { + throw new Error("FATAL error while loading the test: " + ioe); + } + } + display(">OK."); + int safeConnections = i - CONNECTIONS_RESERVE; + if (safeConnections < 1) { + safeConnections = 1; + } + if (safeConnections < MAX_CONNECTIONS) { + complain("------------------------- CAUTION: -------------------"); + complain("While checking the OS limitations, the test found that"); + complain("only " + i + " TCP/IP socket connections could be safely open"); + complain("simultaneously. However, possibility to open at least"); + complain("" + MAX_CONNECTIONS + "+" + CONNECTIONS_RESERVE + + " connections were expected."); + complain(""); + complain("So, the test will check only " + safeConnections + " connection" + + (safeConnections == 1 ? "" : "s") + " which seem"); + complain("safe to be open simultaneously."); + complain("------------------------------------------------------"); + } + return safeConnections; + } + + //----------------------------------------------------------------// + /** + * Re-calls to the method <code>run(args[],out)</code> actually performing + * the test. After <code>run(args[],out)</code> stops, follow JDK-like + * convention for exit codes. I.e.: stop with exit status 95 if the test has + * passed, or with status 97 if the test has failed. + * + * @see #run(String[],PrintStream) + */ + public static void main(String args[]) { + int exitCode = run(args, System.out); + System.exit(exitCode + 95); + // JCK-like exit status. + } + + public static int run(String args[], PrintStream out) { + HugeDataTransferTest.out = out; + + // + // Get the Internet address of the local machine. + // + InetAddress address = null; + try { + address = InetAddress.getLocalHost(); + } catch (UnknownHostException exception) { + complain(exception.toString()); + return 2; // FAILED + } + display("Host: " + address); + + // + // Detect if it is safe to open MAX_CONNETIONS simultaneously: + // + final int CONNECTIONS = detectOSLimitation(); + + // + // Assign ServerSocket, and start client VM which should open + // the prescribed number of CONNECTIONS to that ServerSocket. + // + ServerSocket serverSocket; + try { + final int anyPort = 0; + final int defaultBacklog = BACKLOG_QUEUE_LENGTH; + serverSocket = new ServerSocket(anyPort, defaultBacklog, address); + } catch (IOException exception) { + complain("Cannot assign a ServerSocket on: " + address); + return 2; + } + + // + // Start the client process on different VM. + // + String jdkPath = System.getProperty("test.jdk"); + Path toolName = Paths.get("bin", "java" + (isWindows() ? ".exe" : "")); + Path jdkTool = Paths.get(jdkPath, toolName.toString()); + + String IPAddress = address.getHostAddress(); + int localPort = serverSocket.getLocalPort(); + String arguments = " " + CONNECTIONS + " " + IPAddress + " " + localPort; + //String command = args[0] + " " + network006.class.getName() + "$Client " + arguments; + String command = jdkTool.toAbsolutePath().toString() + " " + Client.class.getName() + " " + arguments; + try { + SO_TIMEOUT = Integer.parseInt(args[0]) * 60 * 1000; + } catch (NumberFormatException e) { + complain("Wrong timeout argument: " + e); + return 2; + } + + Runtime runtime = Runtime.getRuntime(); + + Process client = null; + IORedirector redirectOut = null; + IORedirector redirectErr = null; + + try { + // Start clients on different JVM: + client = runtime.exec(command); + + // Provide clients with access to stderr and stdout: + InputStream clientOut = client.getInputStream(); + InputStream clientErr = client.getErrorStream(); + redirectOut = new IORedirector(clientOut, DEBUG_MODE ? out : null); + redirectErr = new IORedirector(clientErr, out); + redirectOut.start(); + redirectErr.start(); + + } catch (IOException exception) { + complain("Failed to start client: " + exception); + return 2; + } + // + // Start the server threads (and let them establish connections): + // + + Server server[] = new Server[CONNECTIONS]; + for (int i = 0; i < CONNECTIONS; i++) { + server[i] = new Server(serverSocket); + display("Server #" + i + ": " + server[i]); + server[i].start(); + } + + // + // Wait for the servers and the clients: + // + boolean testFailed = false; + + try { + client.waitFor(); + int clientStatus = client.exitValue(); + display("Client VM exitCode=" + clientStatus); + + // Let I/O redirectors to flush: + if (redirectOut.isAlive()) { + redirectOut.join(); + } + if (redirectErr.isAlive()) { + redirectErr.join(); + } + + // If client has crashed, also terminate the server (to avoid hangup). + if (clientStatus != 95) { + complain("Client VM has crashed: exit status=" + clientStatus); + testFailed = true; + } + + // Client has finished OK; wait for the server. + for (int i = 0; i < CONNECTIONS; i++) { + display("Server: waiting for #" + i); + if (server[i].isAlive()) { + display("Server #" + i + ": (joining...)" + server[i]); + server[i].join(); + } + if (server[i].exception != null) { + if (server[i].message != null) { + complain("Server #" + i + "(finished): with message:" + server[i].message); + } + + complain("Server #" + i + "(finished): " + server[i].exception); + server[i].exception.printStackTrace(out); + out.flush(); +// complain("Server #"+i+": "+server[i].exception.getStackTrace()); + testFailed = true; + } + } + + } catch (InterruptedException exception) { + complain("Test interrupted: " + exception); + testFailed = true; + } + + if (testFailed) { + complain("Test failed."); + } else { + display("Test passed."); + } + return testFailed ? 2 : 0; + } + + private static boolean isWindows() { + return System.getProperty("os.name").toLowerCase().startsWith("win"); + } + //----------------------------------------------------------------// + /** + * Log stream for error messages and/or (optional) execution trace. + */ + private static PrintStream out; + + /** + * Print error message. + */ + private static synchronized void complain(Object message) { + out.println("# " + message); + out.flush(); + } + + ; + + /** + * Display optional report: comment ca va? + */ + private static synchronized void display(Object report) { + if (DEBUG_MODE) { + out.println(report.toString()); + } + out.flush(); //todo shouldn't this be inside if?? + } + + ; + + //----------------------------------------------------------------// + + /** + * Server thread should reply to data parcels sent by Client VM. + */ + private static class Server extends Thread { + + /** + * The socket is assigned at the Server instantiation. + */ + private ServerSocket serverSocket; + + /** + * The socket is assigned at the Server runtime. + */ + private Socket socket; + + /** + * Display the server socket. + */ + @Override + public String toString() { + + return "ServerSocket: " + serverSocket.toString(); +// + " socket: " + socket.toString(); + } + + /** + * Which port is this socket listening? + */ + int getPort() { + return serverSocket.getLocalPort(); + } + + /** + * Find some free port at the given <code>address</code> and attach new + * server to hear that port. // lidsten to?? + */ + public Server(ServerSocket serverSocket) { + this.serverSocket = serverSocket; + } + + /** + * Exception just arisen while the server was working, or + * <code>null</code> if it was OK with the server. + */ + Exception exception = null; + String message = null; + + /** + * Accept connection, then reply to client's parcels. + */ + @Override + public void run() { + try { + socket = serverSocket.accept(); + socket.setSoTimeout(SO_TIMEOUT); + + InputStream istream = socket.getInputStream(); + OutputStream ostream = socket.getOutputStream(); + + Random random = new Random(getPort()); + + for (int i = 0; i < DATA_PARCELS; i++) { + Parcel etalon = new Parcel(random); + message = "reading parcel number " + i; + Parcel sample = new Parcel(istream); // read + if (!sample.equals(etalon)) { + complain("Server thread for port #" + + getPort() + " got unexpected parcel:\n" + + "sample=" + sample + "\n" + + "etalon=" + etalon); + throw new TestFailure( //received?? + "server has read unexpected parcel"); + } + message = "sending parcel number " + i; + etalon.send(ostream); + ostream.flush(); + } + + int datum = istream.read(); // wait for client close() + if (datum >= 0) { + throw new TestFailure( + "server has read ambigous byte: " + datum); + } + + ostream.close(); // implies: socket.close(); + + } catch (Exception oops) { + exception = oops; + } + } + } + + //----------------------------------------------------------------// + /** + * Client VM should send data parcels to Server VM and recieve and verify + * the server's replies. + */ + private static class Client extends Thread { + + /** + * This thread uses the single client socket. + */ + private Socket socket; + + /** + * Address and port of this socket. + */ + @Override + public String toString() { + return socket.toString(); + } + + /** + * Did the thread failed? If yes, what is the failure's reason. + */ + Exception exception = null; + String message = null; + + public static java.io.PrintStream complainStream = System.out; + public static java.io.PrintStream displayStream = System.err; + + /** + * Connect client socket on the given <code>address</code> and + * <code>port</code>. + */ + Client(InetAddress address, int port) throws IOException { + socket = new Socket(address, port); + socket.setSoTimeout(SO_TIMEOUT); + } + + /** + * What is the port number this socket is listening for? + */ + int getPort() { + return socket.getPort(); + } + + /** + * Establish connection, then read/respond <code>DATA_PARCELS</code> + * parcels of random data. Set initial seed for pseudo-random numbers + * generator to the value of the local port number. + * + * @see #DATA_PARCELS + * @see #getPort() + */ + @Override + public void run() { + try { + InputStream istream = socket.getInputStream(); + OutputStream ostream = socket.getOutputStream(); + + Random random = new Random(getPort()); + // suggested by Oleg -- to avoid race conditions + /* try{ + Thread.sleep(500); + } + catch (java.lang.InterruptedException e) + { + }*/ + + for (int i = 0; i < DATA_PARCELS; i++) { + Parcel etalon = new Parcel(random); + message = "sending parcel number: " + i; + etalon.send(ostream); + ostream.flush(); + + message = "reading parcel number: " + i; + Parcel sample = new Parcel(istream); // read + if (!sample.equals(etalon)) { + complain("Client thread for port #" + + getPort() + " got unexpected parcel:\n" + + "sample=" + sample + "\n" + + "etalon=" + etalon); + throw new TestFailure( + "parcel context is unexpected to client"); + } + } + + if (istream.available() > 0) { + int datum = istream.read(); + throw new TestFailure( + "client has read ambigous byte: " + datum); + } + ostream.close(); // implies: socket.close() + + } catch (Exception oops) { + exception = oops; + } + } + + /** + * Establish lots of connections to server socket, attack servers with + * huge data parcels, and check if they reply correctly. The number of + * connections to try, the address and port number for the server socket + * are passed through <code>args[]</code>, like: + * <pre> + * java network006$Client connections_to_try address port + * </pre> + */ + public static void main(String args[]) { + if (DEBUG_MODE) { + try { + String filename = "Client" + ((args.length == 3) ? args[2] : "new"); + displayStream = new PrintStream(filename + ".out"); + complainStream = new PrintStream(filename + ".err"); + } catch (FileNotFoundException exception) { + complain(exception); + } + + } + + if (args.length != 3) { + complain("Client expects 3 paramenets:"); + complain(" java " + Client.class.getName() + " connections_to_try address port"); + exit(1); // FAILED + } + + int CONNECTIONS = Integer.parseInt(args[0]); + display("Client VM: will try " + CONNECTIONS + " connections."); + InetAddress address; + try { + address = InetAddress.getByName(args[1]); + } catch (UnknownHostException exception) { + address = null; + complain("Client: cannot find host: \"" + args[1] + "\""); + exit(4); + } + display("Client: host to contact: " + address); + int port = Integer.parseInt(args[2]); + display("Client: port to contact: " + port); + + // + // Establish connections, and start client processes: + // + Client client[] = new Client[CONNECTIONS]; + for (int i = 0; i < CONNECTIONS; i++) { + try { + client[i] = new Client(address, port); + display("Client #" + i + ": " + client[i]); + + } catch (IOException ioe) { + complain("Client #" + i + "(creation): " + ioe); + ioe.printStackTrace(complainStream); + complainStream.flush(); +// complain("Client #" + i + "(creation): " + ioe.getStackTrace()); + exit(3); + } + } + + for (int i = 0; i < CONNECTIONS; i++) { + client[i].start(); + } + + // + // Wait until testing is not finished: + // + int status = 0; + for (int i = 0; i < CONNECTIONS; i++) { + display("Client: waiting for #" + i); + if (client[i].isAlive()) { + display("Client #" + i + ": (joining...)" + client[i]); + + try { + client[i].join(); + } catch (InterruptedException ie) { + complain("Client #" + i + ": " + ie); + status = 3; + } + } + if (client[i].exception != null) { + if (client[i].message != null) { + complain("Client #" + i + "(finished) with message: " + client[i].message); + } + complain("Client #" + i + "(finished): " + client[i].exception); + client[i].exception.printStackTrace(complainStream); + complainStream.flush(); + if (status == 0) { + status = 2; + } + } + } + + exit(status); + } + + /** + * Print error message. + */ + private static synchronized void complain(Object message) { + complainStream.println("# " + message); + complainStream.flush(); + } + + /** + * Display execution trace. + */ + private static synchronized void display(Object message) { + if (!DEBUG_MODE) { + return; + } + displayStream.println(message.toString()); + displayStream.flush(); + } + + /** + * Exit with JCK-like status. + */ + private static void exit(int exitCode) { + int status = exitCode + 95; +// display("Client: exiting with code=" + status); + System.exit(status); + } + } + + /** + * Two of such threads should redirect <code>out</code> and <code>err</code> + * streams of client VM. + */ + private static class IORedirector extends Thread { + + /** + * Source stream. + */ + InputStream in; + /** + * Destination stream. + */ + OutputStream out; + + /** + * Redirect <code>in</code> to <code>out</code>. + */ + public IORedirector(InputStream in, OutputStream out) { + this.in = in; + this.out = out; + } + + /** + * Read input stream until the EOF, and write everithing to output + * stream. If output stream is assigned to <code>null</code>, do not + * print anything, but read the input stream anywhere. + */ + @Override + public void run() { + try { + for (;;) { + int symbol = in.read(); + if (symbol < 0) { + break; // EOF + } + if (out != null) { + out.write(symbol); + } + } + + if (out != null) { + out.flush(); + } + + } catch (IOException exception) { + throw new TestFailure("IORedirector exception: " + exception); + } + } + } + + //----------------------------------------------------------------// + /** + * A data parcel to be sent/recieved between Client VM and Server thread. + * When data parcel is sent, first 4 bytes are transfered which encode the + * <code>int</code> number equal to size of the parcel minus 1. I.e.: if + * number of data bytes in the parcel's contents is <code>N</code>, then the + * first 4 bytes encode the number <code>N-1</code>. After that, the + * parcel's contents bytes are transered. + */ + static class Parcel { + + private final byte[] parcel; + + /** + * Display all bytes as integer values from 0 to 255; or return + * ``<tt>null</tt>'' if this Parcel is not yet initialized. + */ + @Override + public String toString() { + if (parcel == null) { + return "null"; + } + String s = "{"; + for (int i = 0; i < parcel.length; i++) { + s += (i > 0 ? ", " : "") + ((int) parcel[i] & 0xFF); + } + return s + "}"; + } + + /** + * Generate new <code>parcel[]</code> array using the given + * <code>random</code> numbers generator. Client and Server threads + * should use identical <code>random</code> generators, so that those + * threads could generate equal data parcels and check the parcel just + * transfered. + */ + public Parcel(Random random) { + int size = random.nextInt(MAX_PARCEL) + 1; + parcel = new byte[size]; + for (int i = 0; i < size; i++) { + parcel[i] = (byte) random.nextInt(256); + } + } + + ; + + /** + * Read exactly <code>size</code> bytes from the <code>istream</code> + * if possible, or throw <code>TestFailure</code> if unexpected end of + * <code>istream</code> occurs. + */ + private static byte[] readBytes(int size, InputStream istream) + throws IOException { + + byte data[] = new byte[size]; + for (int i = 0; i < size; i++) { + int datum = istream.read(); + if (datum < 0) { + throw new TestFailure( + "unexpected EOF: have read: " + i + " bytes of " + size); + } + data[i] = (byte) datum; + } + return data; + } + + /** + * Read 4 bytes from <code>istream</code> and threat them to encode size + * of data parcel following these 4 bytes. + */ + private static int getSize(InputStream istream) throws IOException { + byte data[] = readBytes(4, istream); + int data0 = (int) data[0] & 0xFF; + int data1 = (int) data[1] & 0xFF; + int data2 = (int) data[2] & 0xFF; + int data3 = (int) data[3] & 0xFF; + int sizeWord = data0 + (data1 << 8) + (data2 << 16) + (data3 << 24); + int size = sizeWord + 1; + if (size <= 0) { + throw new TestFailure("illegal size: " + size); + } + return size; + } + + /** + * Send 4 bytes encoding actual size of the parcel just to be + * transfered. + */ + private static void putSize(OutputStream ostream, int size) + throws IOException { + + if (size <= 0) { + throw new TestFailure("illegal size: " + size); + } + + int sizeWord = size - 1; + byte data[] = new byte[4]; + data[0] = (byte) sizeWord; + data[1] = (byte) (sizeWord >> 8); + data[2] = (byte) (sizeWord >> 16); + data[3] = (byte) (sizeWord >> 24); + ostream.write(data); + } + + /** + * Recieve data parcel. + */ + public Parcel(InputStream istream) throws IOException { + int size = getSize(istream); + parcel = readBytes(size, istream); + } + + /** + * Send <code>this</code> data parcel. + */ + public void send(OutputStream ostream) throws IOException { + int size = parcel.length; + putSize(ostream, size); + ostream.write(parcel); + } + + /** + * Check byte-to-byte equality between <code>this</code> and the + * <code>other</code> parcels. + */ + public boolean equals(Parcel other) { + if (this.parcel.length != other.parcel.length) { + return false; + } + int size = parcel.length; + for (int i = 0; i < size; i++) { + if (this.parcel[i] != other.parcel[i]) { + return false; + } + } + return true; + } + } + + /** + * Server or Client may throw this exception to report the test failure. + */ + static class TestFailure extends RuntimeException { + + /** + * Report particular <code>purpose</code> of the test failure. + */ + public TestFailure(String purpose) { + super(purpose); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2017, 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. + */ + +/* + * @test + * @bug 8184328 + * @summary JDK8u131-b34-socketRead0 hang at SSL read + * @run main/othervm SSLSocketCloseHang + */ + +import java.io.*; +import java.net.*; +import java.util.*; +import java.security.*; +import javax.net.ssl.*; + +public class SSLSocketCloseHang { + + /* + * ============================================================= + * Set the various variables needed for the tests, then + * specify what tests to run on each side. + */ + + /* + * Should we run the client or server in a separate thread? + * Both sides can throw exceptions, but do you have a preference + * as to which side should be the main thread. + */ + static boolean separateServerThread = true; + + /* + * Where do we find the keystores? + */ + static String pathToStores = "../../../../javax/net/ssl/etc"; + static String keyStoreFile = "keystore"; + static String trustStoreFile = "truststore"; + static String passwd = "passphrase"; + + /* + * Is the server ready to serve? + */ + volatile static boolean serverReady = false; + + /* + * Was the client responsible for closing the socket + */ + volatile static boolean clientClosed = false; + + /* + * Turn on SSL debugging? + */ + static boolean debug = false; + + /* + * If the client or server is doing some kind of object creation + * that the other side depends on, and that thread prematurely + * exits, you may experience a hang. The test harness will + * terminate all hung threads after its timeout has expired, + * currently 3 minutes by default, but you might try to be + * smart about it.... + */ + + /* + * Define the server side of the test. + * + * If the server prematurely exits, serverReady will be set to true + * to avoid infinite hangs. + */ + void doServerSide() throws Exception { + SSLServerSocketFactory sslssf = + (SSLServerSocketFactory) SSLServerSocketFactory.getDefault(); + SSLServerSocket sslServerSocket = + (SSLServerSocket) sslssf.createServerSocket(serverPort); + + serverPort = sslServerSocket.getLocalPort(); + + /* + * Signal Client, we're ready for his connect. + */ + serverReady = true; + + SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept(); + sslSocket.startHandshake(); + while (!clientClosed) { + Thread.sleep(500); + } + } + + /* + * Define the client side of the test. + * + * If the server prematurely exits, serverReady will be set to true + * to avoid infinite hangs. + */ + void doClientSide() throws Exception { + boolean caught = false; + + /* + * Wait for server to get started. + */ + System.out.println("waiting on server"); + while (!serverReady) { + Thread.sleep(50); + } + System.out.println("server ready"); + + Socket baseSocket = new Socket("localhost", serverPort); + baseSocket.setSoTimeout(100); + + SSLSocketFactory sslsf = + (SSLSocketFactory) SSLSocketFactory.getDefault(); + SSLSocket sslSocket = (SSLSocket) + sslsf.createSocket(baseSocket, "localhost", serverPort, false); + + // handshaking + sslSocket.startHandshake(); + System.out.println("handshake done"); + + Thread.sleep(500); + System.out.println("client closing"); + + sslSocket.close(); + clientClosed = true; + System.out.println("client closed"); + } + + /* + * ============================================================= + * The remainder is just support stuff + */ + + // use any free port by default + volatile int serverPort = 0; + + volatile Exception serverException = null; + volatile Exception clientException = null; + + volatile byte[] serverDigest = null; + + public static void main(String[] args) throws Exception { + String keyFilename = + System.getProperty("test.src", "./") + "/" + pathToStores + + "/" + keyStoreFile; + String trustFilename = + System.getProperty("test.src", "./") + "/" + pathToStores + + "/" + trustStoreFile; + + System.setProperty("javax.net.ssl.keyStore", keyFilename); + System.setProperty("javax.net.ssl.keyStorePassword", passwd); + System.setProperty("javax.net.ssl.trustStore", trustFilename); + System.setProperty("javax.net.ssl.trustStorePassword", passwd); + + if (debug) + System.setProperty("javax.net.debug", "all"); + + /* + * Start the tests. + */ + new SSLSocketCloseHang(); + } + + Thread clientThread = null; + Thread serverThread = null; + + /* + * Primary constructor, used to drive remainder of the test. + * + * Fork off the other side, then do your work. + */ + SSLSocketCloseHang() throws Exception { + if (separateServerThread) { + startServer(true); + startClient(false); + } else { + startClient(true); + startServer(false); + } + + /* + * Wait for other side to close down. + */ + if (separateServerThread) { + serverThread.join(); + } else { + clientThread.join(); + } + + /* + * When we get here, the test is pretty much over. + * + * If the main thread excepted, that propagates back + * immediately. If the other thread threw an exception, we + * should report back. + */ + if (serverException != null) { + System.out.print("Server Exception:"); + throw serverException; + } + if (clientException != null) { + System.out.print("Client Exception:"); + throw clientException; + } + } + + void startServer(boolean newThread) throws Exception { + if (newThread) { + serverThread = new Thread() { + public void run() { + try { + doServerSide(); + } catch (Exception e) { + /* + * Our server thread just died. + * + * Release the client, if not active already... + */ + System.err.println("Server died..."); + System.err.println(e); + serverReady = true; + serverException = e; + } + } + }; + serverThread.start(); + } else { + doServerSide(); + } + } + + void startClient(boolean newThread) throws Exception { + if (newThread) { + clientThread = new Thread() { + public void run() { + try { + doClientSide(); + } catch (Exception e) { + /* + * Our client thread just died. + */ + System.err.println("Client died..."); + clientException = e; + } + } + }; + clientThread.start(); + } else { + doClientSide(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/tools/jarsigner/LineBrokenMultiByteCharacter.java Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2017, 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. + */ + +/* + * @test + * @bug 6695402 + * @summary verify signatures of jars containing classes with names + * with multi-byte unicode characters broken across lines + * @library /test/lib + */ + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.jar.JarFile; +import java.util.jar.Attributes.Name; +import java.util.jar.JarEntry; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import jdk.test.lib.SecurityTools; +import jdk.test.lib.util.JarUtils; + +public class LineBrokenMultiByteCharacter { + + /** + * this name will break across lines in MANIFEST.MF at the + * middle of a two-byte utf-8 encoded character due to its e acute letter + * at its exact position. + * + * because no file with such a name exists {@link JarUtils} will add the + * name itself as contents to the jar entry which would have contained a + * compiled class in the original bug. For this test, the contents of the + * files contained in the jar file is not important as long as they get + * signed. + * + * @see #verifyClassNameLineBroken(JarFile, String) + */ + static final String testClassName = + "LineBrokenMultiByteCharacterA1234567890B1234567890C123456789D12\u00E9xyz.class"; + + static final String anotherName = + "LineBrokenMultiByteCharacterA1234567890B1234567890C123456789D1234567890.class"; + + static final String alias = "a"; + static final String keystoreFileName = "test.jks"; + static final String manifestFileName = "MANIFEST.MF"; + + public static void main(String[] args) throws Exception { + prepare(); + + testSignJar("test.jar"); + testSignJarNoManifest("test-no-manifest.jar"); + testSignJarUpdate("test-update.jar", "test-updated.jar"); + } + + static void prepare() throws Exception { + SecurityTools.keytool("-keystore", keystoreFileName, "-genkeypair", + "-storepass", "changeit", "-keypass", "changeit", "-storetype", + "JKS", "-alias", alias, "-dname", "CN=X", "-validity", "366") + .shouldHaveExitValue(0); + + Files.write(Paths.get(manifestFileName), (Name. + MANIFEST_VERSION.toString() + ": 1.0\r\n").getBytes(UTF_8)); + } + + static void testSignJar(String jarFileName) throws Exception { + JarUtils.createJar(jarFileName, manifestFileName, testClassName); + verifyJarSignature(jarFileName); + } + + static void testSignJarNoManifest(String jarFileName) throws Exception { + JarUtils.createJar(jarFileName, testClassName); + verifyJarSignature(jarFileName); + } + + static void testSignJarUpdate( + String initialFileName, String updatedFileName) throws Exception { + JarUtils.createJar(initialFileName, manifestFileName, anotherName); + SecurityTools.jarsigner("-keystore", keystoreFileName, "-storetype", + "JKS", "-storepass", "changeit", "-debug", initialFileName, + alias).shouldHaveExitValue(0); + JarUtils.updateJar(initialFileName, updatedFileName, testClassName); + verifyJarSignature(updatedFileName); + } + + static void verifyJarSignature(String jarFileName) throws Exception { + // actually sign the jar + SecurityTools.jarsigner("-keystore", keystoreFileName, "-storetype", + "JKS", "-storepass", "changeit", "-debug", jarFileName, alias) + .shouldHaveExitValue(0); + + try ( + JarFile jar = new JarFile(jarFileName); + ) { + verifyClassNameLineBroken(jar, testClassName); + verifyCodeSigners(jar, jar.getJarEntry(testClassName)); + } + } + + /** + * it would be too easy to miss the actual test case by just renaming an + * identifier so that the multi-byte encoded character would not any longer + * be broken across a line break. + * + * this check here verifies that the actual test case is tested based on + * the manifest and not based on the signature file because at the moment, + * the signature file does not even contain the desired entry at all. + * + * this relies on {@link java.util.jar.Manifest} breaking lines unaware + * of bytes that belong to the same multi-byte utf characters. + */ + static void verifyClassNameLineBroken(JarFile jar, String className) + throws IOException { + byte[] eAcute = "\u00E9".getBytes(UTF_8); + byte[] eAcuteBroken = + new byte[] {eAcute[0], '\r', '\n', ' ', eAcute[1]}; + + if (jar.getManifest().getAttributes(className) == null) { + throw new AssertionError(className + " not found in manifest"); + } + + JarEntry manifestEntry = jar.getJarEntry(JarFile.MANIFEST_NAME); + try ( + InputStream manifestIs = jar.getInputStream(manifestEntry); + ) { + int bytesMatched = 0; + for (int b = manifestIs.read(); b > -1; b = manifestIs.read()) { + if ((byte) b == eAcuteBroken[bytesMatched]) { + bytesMatched++; + if (bytesMatched == eAcuteBroken.length) { + break; + } + } else { + bytesMatched = 0; + } + } + if (bytesMatched < eAcuteBroken.length) { + throw new AssertionError("self-test failed: multi-byte " + + "utf-8 character not broken across lines"); + } + } + } + + static void verifyCodeSigners(JarFile jar, JarEntry jarEntry) + throws IOException { + // codeSigners is initialized only after the entry has been read + try ( + InputStream inputStream = jar.getInputStream(jarEntry); + ) { + inputStream.readAllBytes(); + } + + // a check for the presence of code signers is sufficient to check + // bug JDK-6695402. no need to also verify the actual code signers + // attributes here. + if (jarEntry.getCodeSigners() == null + || jarEntry.getCodeSigners().length == 0) { + throw new AssertionError( + "no signing certificate found for " + jarEntry.getName()); + } + } + +}
--- a/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 8163800 8175200 + * @bug 8163800 8175200 8186332 * @summary The fix for JDK-8072052 shows up other minor incorrect use of styles * @library ../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -51,11 +51,11 @@ checkOutput("p/C1.html", true, "<code><a href=\"../p/C2.html\" title=\"class in p\">C2</a></code>", - "<code><span class=\"memberNameLink\"><a href=\"../p/C1.html#C1--\">C1</a></span>​()</code>"); + "<code><span class=\"memberNameLink\"><a href=\"../p/C1.html#C1--\">C1</a></span>()</code>"); checkOutput("p/C2.html", true, "<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>", - "<code><span class=\"memberNameLink\"><a href=\"../p/C2.html#C2--\">C2</a></span>​()</code>"); + "<code><span class=\"memberNameLink\"><a href=\"../p/C2.html#C2--\">C2</a></span>()</code>"); checkOutput("p/C3.html", true, "<code><a href=\"../p/I1.html\" title=\"interface in p\">I1</a></code>, " @@ -63,7 +63,7 @@ + "<code><a href=\"../p/I2.html\" title=\"interface in p\">I2</a></code>, " + "<code><a href=\"../p/IT1.html\" title=\"interface in p\">IT1</a><T></code>, " + "<code><a href=\"../p/IT2.html\" title=\"interface in p\">IT2</a><java.lang.String></code>", - "<code><span class=\"memberNameLink\"><a href=\"../p/C3.html#C3--\">C3</a></span>​()</code>"); + "<code><span class=\"memberNameLink\"><a href=\"../p/C3.html#C3--\">C3</a></span>()</code>"); checkOutput("p/I1.html", true, "<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
--- a/test/langtools/jdk/javadoc/doclet/testConstructors/TestConstructors.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testConstructors/TestConstructors.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 8025524 8031625 8081854 8175200 + * @bug 8025524 8031625 8081854 8175200 8186332 * @summary Test for constructor name which should be a non-qualified name. * @author Bhavesh Patel * @library ../lib @@ -58,19 +58,19 @@ + "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, " + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>" + "NestedInner(int)</code></a>", - "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>​()", + "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()", "<a name=\"Outer--\">", "<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>​(int i)", "<a name=\"Outer-int-\">"); checkOutput("pkg1/Outer.Inner.html", true, - "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>​()", + "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()", "<a name=\"Inner--\">", "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>​(int i)", "<a name=\"Inner-int-\">"); checkOutput("pkg1/Outer.Inner.NestedInner.html", true, - "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>​()", + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()", "<a name=\"NestedInner--\">", "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>​(int i)", "<a name=\"NestedInner-int-\">");
--- a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 4927552 8026567 8071982 8162674 8175200 8175218 + * @bug 4927552 8026567 8071982 8162674 8175200 8175218 8183511 8186332 * @summary <DESC> * @author jamieh * @library ../lib @@ -81,85 +81,85 @@ + "extends java.lang.Object</pre>", "<pre>@Deprecated(forRemoval=true)\n" + "public int field</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>", + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>", "<pre>@Deprecated(forRemoval=true)\n" - + "public DeprecatedClassByAnnotation​()</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>", + + "public DeprecatedClassByAnnotation()</pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>", "<pre>@Deprecated\n" - + "public void method​()</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"); + + "public void method()</pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"); checkOutput("pkg/TestAnnotationType.html", true, - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" - + "<div class=\"block\"><span class=\"deprecationComment\">annotation_test1 passes.</span></div>\n" - + "</div>\n" - + "<br>\n" + "<hr>\n" + "<pre>@Deprecated(forRemoval=true)\n" + "@Documented\n" - + "public @interface <span class=\"memberNameLabel\">TestAnnotationType</span></pre>", + + "public @interface <span class=\"memberNameLabel\">TestAnnotationType</span></pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" + + "<div class=\"block\"><span class=\"deprecationComment\">annotation_test1 passes.</span></div>\n" + + "</div>\n", "<pre>@Deprecated(forRemoval=true)\n" + "static final int field</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This " + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This " + "API element is subject to removal in a future version.</span> <span class=\"deprecationComment\">annotation_test4 passes.</span></div>", "<pre>@Deprecated(forRemoval=true)\n" + "int required</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " + "<span class=\"deprecationComment\">annotation_test3 passes.</span></div>", "<pre>java.lang.String optional</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">annotation_test2 passes.</span></div>"); + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">annotation_test2 passes.</span></div>"); checkOutput("pkg/TestClass.html", true, - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" - + "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes.</span></div>\n" - + "</div>\n" - + "<br>\n" + "<hr>\n" + "<pre>@Deprecated(forRemoval=true)\n" + "public class <span class=\"typeNameLabel\">TestClass</span>\n" - + "extends java.lang.Object</pre>", + + "extends java.lang.Object</pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" + + "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes.</span></div>\n" + + "</div>", "<pre>@Deprecated(forRemoval=true)\n" - + "public TestClass​()</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " + + "public TestClass()</pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " + "<span class=\"deprecationComment\">class_test3 passes.</span></div>"); checkOutput("pkg/TestEnum.html", true, - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" - + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n" - + "</div>\n" - + "<br>\n" + "<hr>\n" + "<pre>@Deprecated(forRemoval=true)\n" + "public enum <span class=\"typeNameLabel\">TestEnum</span>\n" - + "extends java.lang.Enum<<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a>></pre>", + + "extends java.lang.Enum<<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a>></pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" + + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n" + + "</div>", "<pre>@Deprecated(forRemoval=true)\n" + "public static final <a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a> FOR_REMOVAL</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " + "<span class=\"deprecationComment\">enum_test3 passes.</span></div>"); checkOutput("pkg/TestError.html", true, - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" - + "<div class=\"block\"><span class=\"deprecationComment\">error_test1 passes.</span></div>\n" - + "</div>\n" - + "<br>\n" + "<hr>\n" + "<pre>@Deprecated(forRemoval=true)\n" + "public class <span class=\"typeNameLabel\">TestError</span>\n" - + "extends java.lang.Error</pre>"); + + "extends java.lang.Error</pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" + + "<div class=\"block\"><span class=\"deprecationComment\">error_test1 passes.</span></div>\n" + + "</div>"); checkOutput("pkg/TestException.html", true, - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" - + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n" - + "</div>\n" - + "<br>\n" + "<hr>\n" + "<pre>@Deprecated(forRemoval=true)\n" + "public class <span class=\"typeNameLabel\">TestException</span>\n" - + "extends java.lang.Exception</pre>"); + + "extends java.lang.Exception</pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" + + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n" + + "</div>"); checkOutput("pkg/TestInterface.html", true, - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" - + "<div class=\"block\"><span class=\"deprecationComment\">interface_test1 passes.</span></div>\n" - + "</div>\n" - + "<br>\n" + "<hr>\n" + "<pre>@Deprecated(forRemoval=true)\n" + "public class <span class=\"typeNameLabel\">TestInterface</span>\n" - + "extends java.lang.Object</pre>"); + + "extends java.lang.Object</pre>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" + + "<div class=\"block\"><span class=\"deprecationComment\">interface_test1 passes.</span></div>\n" + + "</div>"); checkOutput("deprecated-list.html", true, "<ul>\n"
--- a/test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 6786690 6820360 8025633 8026567 8175200 + * @bug 6786690 6820360 8025633 8026567 8175200 8183511 8186332 * @summary This test verifies the nesting of definition list tags. * @author Bhavesh Patel * @library ../lib @@ -367,12 +367,12 @@ // Test with -nocomment and -nodeprecated options. The ClassDocs whould // not display definition lists for any member details. checkOutput("pkg1/C1.html", expectFound, - "<pre>public void readObject​()\n" + + "<pre>public void readObject()\n" + " throws java.io.IOException</pre>\n" + "</li>"); checkOutput("pkg1/C2.html", expectFound, - "<pre>public C2​()</pre>\n" + + "<pre>public C2()</pre>\n" + "</li>"); checkOutput("pkg1/C1.ModalExclusionType.html", expectFound, @@ -385,7 +385,7 @@ checkOutput("serialized-form.html", expectFound, "<pre>boolean " + "undecorated</pre>\n" + - "<div class=\"block\"><span class=\"deprecatedLabel\">" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">" + "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" + "setUndecorated(boolean)</code></a>.</span></div>\n" +
--- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200 + * @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200 8186332 * @summary Verify that the public modifier does not show up in the * documentation for public methods, as recommended by the JLS. * If A implements I and B extends A, B should be in the list of @@ -64,7 +64,7 @@ checkExit(Exit.OK); checkOutput("pkg/Interface.html", true, - "<pre>int method​()</pre>", + "<pre>int method()</pre>", "<pre>static final int field</pre>", // Make sure known implementing class list is correct and omits type parameters. "<dl>\n" @@ -119,7 +119,7 @@ + "</dl>"); checkOutput("pkg/Interface.html", false, - "public int method​()", + "public int method()", "public static final int field"); checkOutput("pkg/ClassWithStaticMethod.html", false,
--- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Thu Sep 28 22:15:46 2017 +0200 @@ -24,7 +24,7 @@ /* * @test * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 - * 8167967 8172528 8175200 8178830 8182257 + * 8167967 8172528 8175200 8178830 8182257 8186332 * @summary Test of the JavaFX doclet features. * @author jvalenta * @library ../lib @@ -58,7 +58,7 @@ + "<div class=\"block\">Sets the value of the property rate.</div>\n" + "<dl>\n" + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>", - "<pre>public final double getRate​()</pre>\n" + "<pre>public final double getRate()</pre>\n" + "<div class=\"block\">Gets the value of the property rate.</div>\n" + "<dl>\n" + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>", @@ -78,7 +78,7 @@ "<span class=\"simpleTagLabel\">Property description:</span>", "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" + "<a href=\"../pkg1/C.html#setTestMethodProperty--\">" - + "setTestMethodProperty</a></span>​()</code></th>", + + "setTestMethodProperty</a></span>()</code></th>", "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" + "<a href=\"../pkg1/C.html#pausedProperty\">paused</a></span></code></th>\n" + "<td class=\"colLast\">\n" @@ -88,7 +88,7 @@ + "title=\"class in pkg1\">C.BooleanProperty</a> pausedProperty</pre>\n" + "<div class=\"block\">Defines if paused. The second line.</div>", "<h4>isPaused</h4>\n" - + "<pre>public final double isPaused​()</pre>\n" + + "<pre>public final double isPaused()</pre>\n" + "<div class=\"block\">Gets the value of the property paused.</div>", "<h4>setPaused</h4>\n" + "<pre>public final void setPaused​(boolean value)</pre>\n" @@ -99,7 +99,7 @@ + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" + "<dd>false</dd>", "<h4>isPaused</h4>\n" - + "<pre>public final double isPaused​()</pre>\n" + + "<pre>public final double isPaused()</pre>\n" + "<div class=\"block\">Gets the value of the property paused.</div>\n" + "<dl>\n" + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" @@ -124,7 +124,7 @@ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" + "<dd>JavaFX 8.0</dd>", "<h4>getRate</h4>\n" - + "<pre>public final double getRate​()</pre>\n" + + "<pre>public final double getRate()</pre>\n" + "<div class=\"block\">Gets the value of the property rate.</div>\n" + "<dl>\n" + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" @@ -253,20 +253,20 @@ + "<tr id=\"i1\" class=\"rowColor\">\n" + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" - + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>​()</code></th>\n" + + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>()</code></th>\n" + "<td class=\"colLast\"> </td>\n" + "</tr>\n" + "<tr id=\"i2\" class=\"altColor\">\n" + "<td class=\"colFirst\"><code>java.util.List<java.util.Set<? super java.lang.Object>>" + "</code></td>\n" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" - + "<a href=\"../pkg2/Test.html#deltaProperty--\">deltaProperty</a></span>​()</code></th>\n" + + "<a href=\"../pkg2/Test.html#deltaProperty--\">deltaProperty</a></span>()</code></th>\n" + "<td class=\"colLast\"> </td>\n" + "</tr>\n" + "<tr id=\"i3\" class=\"rowColor\">\n" + "<td class=\"colFirst\"><code>java.util.List<java.lang.String></code></td>\n" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" - + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a></span>​()</code></th>\n" + + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a></span>()</code></th>\n" + "<td class=\"colLast\"> </td>" ); }
--- a/test/langtools/jdk/javadoc/doclet/testLambdaFeature/TestLambdaFeature.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testLambdaFeature/TestLambdaFeature.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 8004893 8022738 8029143 8175200 + * @bug 8004893 8022738 8029143 8175200 8186332 * @summary Make sure that the lambda feature changes work fine in * javadoc. * @author bpatel @@ -55,7 +55,7 @@ checkOutput("pkg/A.html", true, "<td class=\"colFirst\"><code>default void</code></td>", - "<pre>default void defaultMethod​()</pre>", + "<pre>default void defaultMethod()</pre>", "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" + "All Methods</span><span class=\"tabEnd\"> </span></span>" + "<span id=\"t2\" class=\"tableTab\"><span>" @@ -83,7 +83,7 @@ checkOutput("pkg/A.html", false, "<td class=\"colFirst\"><code>default default void</code></td>", - "<pre>default default void defaultMethod​()</pre>"); + "<pre>default default void defaultMethod()</pre>"); checkOutput("pkg/B.html", false, "<td class=\"colFirst\"><code>default void</code></td>",
--- a/test/langtools/jdk/javadoc/doclet/testLiteralCodeInPre/TestLiteralCodeInPre.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testLiteralCodeInPre/TestLiteralCodeInPre.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 8002387 8014636 8078320 8175200 + * @bug 8002387 8014636 8078320 8175200 8186332 * @summary Improve rendered HTML formatting for {@code} * @library ../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -47,19 +47,19 @@ checkExit(Exit.OK); checkOutput("pkg/Test.html", true, - "no_pre​()</pre>\n" + "no_pre()</pre>\n" + "<div class=\"block\">abc<code>def</code>ghi</div>", - "no_pre_extra_whitespace​()</pre>\n" + "no_pre_extra_whitespace()</pre>\n" + "<div class=\"block\">abc<code> def </code>ghi</div>", - "in_pre​()</pre>\n" + "in_pre()</pre>\n" + "<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>", - "pre_after_text​()</pre>\n" + "pre_after_text()</pre>\n" + "<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>", - "after_pre​()</pre>\n" + "after_pre()</pre>\n" + "<div class=\"block\">xyz <pre> pqr </pre> abc<code> def </code>ghi</div>", - "back_in_pre​()</pre>\n" + "back_in_pre()</pre>\n" + "<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>", - "typical_usage_code​()</pre>\n" + "typical_usage_code()</pre>\n" + "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" + " Example: <pre><code>\n" + " line 0 @Override\n" @@ -68,7 +68,7 @@ + " line 3 }\n" + " </code></pre>\n" + " and so it goes.</div>", - "typical_usage_literal​()</pre>\n" + "typical_usage_literal()</pre>\n" + "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" + " Example: <pre>\n" + " line 0 @Override\n" @@ -77,7 +77,7 @@ + " line 3 }\n" + " </pre>\n" + " and so it goes.</div>", - "recommended_usage_literal​()</pre>\n" + "recommended_usage_literal()</pre>\n" + "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" + " Example: <pre>\n" + " line 0 @Override\n" @@ -89,7 +89,7 @@ + " <PRE>\n" + " <b>id </b>\n" + " </PRE></div>", - "<pre>public void htmlAttrInPre1​()</pre>\n" + "<pre>public void htmlAttrInPre1()</pre>\n" + "<div class=\"block\">More html tag outliers.\n" + " <pre>\n" + " @Override\n"
--- a/test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417 + * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417 8186332 * @summary Test the case where the overriden method returns a different * type than the method in the child class. Make sure the * documentation is inherited but the return type isn't. @@ -52,12 +52,12 @@ // Check return type in member summary. "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" - + "returnTypeTest</a></span>​()</code>", + + "returnTypeTest</a></span>()</code>", // Check return type in member detail. "<pre>public <a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">" - + "PublicChild</a> returnTypeTest​()</pre>", + + "PublicChild</a> returnTypeTest()</pre>", "<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">" - + "<a href=\"../pkg/PublicChild.html#PublicChild--\">PublicChild</a></span>​()</code></th>"); + + "<a href=\"../pkg/PublicChild.html#PublicChild--\">PublicChild</a></span>()</code></th>"); checkOutput("pkg/PrivateParent.html", true, "<td class=\"colFirst\"><code>private </code></td>\n"
--- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Thu Sep 28 22:15:46 2017 +0200 @@ -25,7 +25,7 @@ * @test * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823 8166306 - * 8178043 8181622 + * 8178043 8181622 8183511 * @summary Test modules support in javadoc. * @author bpatel * @library ../lib @@ -446,7 +446,7 @@ void checkHtml5Description(boolean found) { checkOutput("moduleA-summary.html", found, "<section role=\"region\">\n" - + "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal:" + " This API element is subject to removal in a future version.</span>\n" + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n" + "</div>\n" @@ -1015,7 +1015,7 @@ void checkModuleDeprecation(boolean found) { checkOutput("moduleA-summary.html", found, - "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:" + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal:" + " This API element is subject to removal in a future version.</span>\n" + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n" + "</div>"); @@ -1031,12 +1031,12 @@ + "</td>\n" + "</tr>"); checkOutput("moduleB-summary.html", !found, - "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated using just the javadoc tag.</span></div>"); checkOutput("moduletags-summary.html", found, "<p>@Deprecated\n" + "</p>", - "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span></div>"); + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>"); } void checkModuleAnnotation() {
--- a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java Thu Sep 28 22:15:46 2017 +0200 @@ -24,7 +24,7 @@ /* * @test * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363 - * 8175200 + * 8175200 8186332 * @summary Run Javadoc on a set of source files that demonstrate new * language features. Check the output to ensure that the new * language features are properly documented. @@ -549,7 +549,7 @@ + "=\"Constructor Annotation\",\n" + " <a href=\"../pkg/AnnotationType.html#required--\">" + "required</a>=1994)\n" - + "public AnnotationTypeUsage​()</pre>", + + "public AnnotationTypeUsage()</pre>", // METHOD "<pre><a href=\"../pkg/AnnotationType.html\" " + "title=\"annotation in pkg\">@AnnotationType</a>(" @@ -557,7 +557,7 @@ + "=\"Method Annotation\",\n" + " <a href=\"../pkg/AnnotationType.html#required--\">" + "required</a>=1994)\n" - + "public void method​()</pre>", + + "public void method()</pre>", // METHOD PARAMS "<pre>public void methodWithParams​(" + "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" @@ -630,11 +630,11 @@ // CONSTRUCTOR "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Constructor Annotation\",\n" + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" - + "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>​()", + + "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>()", // METHOD "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Method Annotation\",\n" + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" - + "public void <span class=\"memberNameLabel\">method</span>​()"); + + "public void <span class=\"memberNameLabel\">method</span>()"); //================================= // Make sure annotation types do not
--- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 4749567 8071982 8175200 + * @bug 4749567 8071982 8175200 8186332 * @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist, -nonavbar, -notree, -stylesheetfile options. * @author Bhavesh Patel * @library ../lib @@ -148,7 +148,7 @@ "<pre>public java.lang.Object <a href=" + "\"../src-html/linksource/Properties.html#line.31\">someProperty</a></pre>", "<pre>public java.lang.Object <a href=" - + "\"../src-html/linksource/Properties.html#line.31\">someProperty</a>​()</pre>"); + + "\"../src-html/linksource/Properties.html#line.31\">someProperty</a>()</pre>"); checkOutput("src-html/linksource/Properties.html", true, "<title>Source code</title>", @@ -161,9 +161,9 @@ "<pre>public int <a href=\"../src-html/linksource/SomeClass.html#line.31\">" + "field</a></pre>", "<pre>public <a href=\"../src-html/linksource/SomeClass.html#line.33\">" - + "SomeClass</a>​()</pre>", + + "SomeClass</a>()</pre>", "<pre>public int <a href=\"../src-html/linksource/SomeClass.html#line.36\">" - + "method</a>​()</pre>"); + + "method</a>()</pre>"); checkOutput("src-html/linksource/SomeClass.html", true, "<title>Source code</title>",
--- a/test/langtools/jdk/javadoc/doclet/testOverridenMethods/TestBadOverride.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testOverridenMethods/TestBadOverride.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 8174839 8175200 + * @bug 8174839 8175200 8186332 * @summary Bad overriding method should not crash * @library ../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -52,7 +52,7 @@ checkOutput("pkg4/Foo.html", true, "<li class=\"blockList\">\n" + "<h4>toString</h4>\n" - + "<pre>public void toString​()</pre>\n" + + "<pre>public void toString()</pre>\n" + "<div class=\"block\">Why can't I do this ?</div>\n" + "</li>"); }
--- a/test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java Thu Sep 28 22:15:46 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 6492694 8026567 8048351 8162363 + * @bug 6492694 8026567 8048351 8162363 8183511 * @summary Test package deprecation. * @author bpatel * @library ../lib/ @@ -48,7 +48,7 @@ checkExit(Exit.OK); checkOutput("pkg1/package-summary.html", true, - "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" + "<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." + "</span></div>" );
--- a/test/langtools/jdk/javadoc/doclet/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Sep 28 22:15:46 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2017, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 6802694 8025633 8026567 + * @bug 6802694 8025633 8026567 8183511 * @summary This test verifies deprecation info in serialized-form.html. * @author Bhavesh Patel * @library ../lib @@ -135,7 +135,7 @@ void checkNoComment(boolean expectFound) { checkOutput("serialized-form.html", expectFound, "<pre>boolean undecorated</pre>\n" - + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">" + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">" + "As of JDK version 1.5, replaced by\n" + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" + "setUndecorated(boolean)</code></a>.</span></div>\n"
--- a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Thu Sep 28 22:15:46 2017 +0200 @@ -24,7 +24,7 @@ /* * @test * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417 - * 8175218 8176452 8181215 8182263 + * 8175218 8176452 8181215 8182263 8183511 * @summary Run tests on doclet stylesheet. * @author jamieh * @library ../lib @@ -186,6 +186,17 @@ + ".constantValuesContainer td a:link, .constantValuesContainer td a:visited {\n" + " font-weight:bold;\n" + "}", + ".deprecationBlock {\n" + + " font-size:14px;\n" + + " font-family:'DejaVu Serif', Georgia, \"Times New Roman\", Times, serif;\n" + + " border-style:solid;\n" + + " border-width:thin;\n" + + " border-radius:10px;\n" + + " padding:10px;\n" + + " margin-bottom:10px;\n" + + " margin-right:10px;\n" + + " display:inline-block;\n" + + "}", "#reset {\n" + " background-color: rgb(255,255,255);\n" + " background-image:url('resources/x.png');\n"
--- a/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java Thu Sep 28 22:15:46 2017 +0200 @@ -25,7 +25,7 @@ /* * @test - * @bug 8173425 + * @bug 8173425 8186332 * @summary tests for the summary tag behavior * @library ../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -87,7 +87,7 @@ checkOutput("p1/A.html", true, "<li class=\"blockList\">\n" + "<h4>m3</h4>\n" - + "<pre>public void m3​()</pre>\n" + + "<pre>public void m3()</pre>\n" + "<div class=\"block\">First sentence some text maybe second sentence.</div>\n" + "</li>\n" );
--- a/test/langtools/jdk/javadoc/doclet/testTagOutput/TestTagOutput.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testTagOutput/TestTagOutput.java Thu Sep 28 22:15:46 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8026370 8026567 + * @bug 8026370 8026567 8183511 * @summary This test checks the generated tag output. * @author Bhavesh Patel * @library ../lib @@ -47,12 +47,12 @@ checkExit(Exit.OK); checkOutput("pkg1/DeprecatedTag.html", true, - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>", - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> " + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>", + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> " + "<span class=\"deprecationComment\">Do not use this.</span></div>"); checkOutput("pkg1/DeprecatedTag.html", false, - "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated." + + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated." + "</span> <span class=\"deprecationComment\"></span></div>"); } }
--- a/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363 8175200 + * @bug 8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363 8175200 8186332 * @summary Make sure that type annotations are displayed correctly * @author Bhavesh Patel * @library ../lib @@ -155,17 +155,17 @@ checkOutput("typeannos/MtdDefaultScope.html", true, "<pre>public <T> <a href=\"../typeannos/MRtnA.html\" " + "title=\"annotation in typeannos\">@MRtnA</a> java.lang.String" - + " method​()</pre>", + + " method()</pre>", // When JDK-8068737 is fixed, we should change the order "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in typeannos\">" + "@MRtnA</a> java.lang.String " + "<a href=\"../typeannos/MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> [] " + "<a href=\"../typeannos/MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> []" - + " array2Deep​()</pre>", + + " array2Deep()</pre>", "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in " - + "typeannos\">@MRtnA</a> java.lang.String[][] array2​()</pre>"); + + "typeannos\">@MRtnA</a> java.lang.String[][] array2()</pre>"); checkOutput("typeannos/MtdModifiedScoped.html", true, "<pre>public final <a href=\"../typeannos/MtdParameterized.html\" " @@ -177,25 +177,25 @@ + "String,<a href=\"../typeannos/MRtnB.html\" title=\"annotation in " + "typeannos\">@MRtnB</a> java.lang.String>,<a href=\"../typeannos/" + "MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> java." - + "lang.String> nestedMtdParameterized​()</pre>"); + + "lang.String> nestedMtdParameterized()</pre>"); // Test for type annotations on method type parameters (MethodTypeParameters.java). checkOutput("typeannos/UnscopedUnmodified.html", true, "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" + "annotation in typeannos\">@MTyParamA</a> java.lang.String>" - + " void methodExtends​()</pre>", + + " void methodExtends()</pre>", "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" + "annotation in typeannos\">@MTyParamA</a> <a href=\"../typeannos/" + "MtdTyParameterized.html\" title=\"class in typeannos\">" + "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" " + "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String" - + ">> void nestedExtends​()</pre>"); + + ">> void nestedExtends()</pre>"); checkOutput("typeannos/PublicModifiedMethods.html", true, "<pre>public final <K extends <a href=\"../typeannos/" + "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " - + "java.lang.String> void methodExtends​()</pre>", + + "java.lang.String> void methodExtends()</pre>", "<pre>public final <K extends <a href=\"../typeannos/" + "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " @@ -204,7 +204,7 @@ + "typeannos/MtdTyParameterized.html\" title=\"class in typeannos\">" + "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" " + "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String" - + ">> void dual​()</pre>"); + + ">> void dual()</pre>"); // Test for type annotations on parameters (Parameters.java). checkOutput("typeannos/Parameters.html", true, @@ -236,11 +236,11 @@ // Test for type annotations on throws (Throws.java). checkOutput("typeannos/ThrDefaultUnmodified.html", true, - "<pre>void oneException​()\n" + "<pre>void oneException()\n" + " throws <a href=\"../typeannos/ThrA.html\" title=\"" + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>", - "<pre>void twoExceptions​()\n" + "<pre>void twoExceptions()\n" + " throws <a href=\"../typeannos/ThrA.html\" title=\"" + "annotation in typeannos\">@ThrA</a> java.lang.RuntimeException,\n" + " <a href=\"../typeannos/ThrA.html\" title=\"" @@ -258,12 +258,12 @@ + "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"); checkOutput("typeannos/ThrWithValue.html", true, - "<pre>void oneException​()\n" + "<pre>void oneException()\n" + " throws <a href=\"../typeannos/ThrB.html\" title=\"" + "annotation in typeannos\">@ThrB</a>(" + "\"m\") java.lang.Exception</pre>", - "<pre>void twoExceptions​()\n" + "<pre>void twoExceptions()\n" + " throws <a href=\"../typeannos/ThrB.html\" title=\"" + "annotation in typeannos\">@ThrB</a>(" + "\"m\") java.lang.RuntimeException,\n" @@ -275,7 +275,7 @@ "<pre><K,<a href=\"../typeannos/TyParaA.html\" title=\"annotation in typeannos\">" + "@TyParaA</a> V extends <a href=\"../typeannos/TyParaA.html\" " + "title=\"annotation in typeannos\">@TyParaA</a> " - + "java.lang.String> void secondAnnotated​()</pre>" + + "java.lang.String> void secondAnnotated()</pre>" ); // Test for type annotations on wildcard type (Wildcards.java). @@ -288,7 +288,7 @@ "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " + "typeannos\">MyList</a><? super <a href=\"../typeannos/WldA.html\" " + "title=\"annotation in typeannos\">@WldA</a> java.lang.String>" - + " returnWcSuper​()</pre>"); + + " returnWcSuper()</pre>"); checkOutput("typeannos/BoundWithValue.html", true, "<pre>void wcSuper​(<a href=\"../typeannos/MyList.html\" title=\"" @@ -301,7 +301,7 @@ + "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB." + "html\" title=\"annotation in typeannos\">@WldB</a>(" + "\"m\") java.lang.String" - + "> returnWcExtends​()</pre>"); + + "> returnWcExtends()</pre>"); // Test for receiver annotations (Receivers.java). checkOutput("typeannos/DefaultUnmodified.html", true, @@ -396,7 +396,7 @@ + "\"../typeannos/RepConstructorB.html\" title=\"annotation in typeannos" + "\">@RepConstructorB</a> <a href=\"../typeannos/RepConstructorB.html" + "\" title=\"annotation in typeannos\">@RepConstructorB</a>\n" - + "RepeatingOnConstructor​()</pre>", + + "RepeatingOnConstructor()</pre>", "<pre><a href=\"../typeannos/RepConstructorA.html\" title=\"annotation in typeannos" + "\">@RepConstructorA</a> <a href=\"../typeannos/RepConstructorA.html" @@ -574,7 +574,7 @@ checkOutput("typeannos/RepeatingOnMethod.html", true, "<code>(package private) java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\">" + "<code><span class=\"memberNameLink\"><a href=" - + "\"../typeannos/RepeatingOnMethod.html#test1--\">test1</a></span>​()</code>", + + "\"../typeannos/RepeatingOnMethod.html#test1--\">test1</a></span>()</code>", "<code>(package private) <a href=\"../typeannos/RepTypeUseA.html\" " + "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href=" @@ -584,7 +584,7 @@ + "\" title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String</code>" + "</td>\n<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" + "<a href=\"../typeannos/RepeatingOnMethod.html#test2--\">test2</a>" - + "</span>​()</code>", + + "</span>()</code>", "<code>(package private) <a href=\"../typeannos/RepTypeUseA.html\" " + "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href=" @@ -594,7 +594,7 @@ + "title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String</code>" + "</td>\n<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" + "<a href=\"../typeannos/RepeatingOnMethod.html#test3--\">test3</a>" - + "</span>​()</code>", + + "</span>()</code>", "<code>(package private) <a href=\"../typeannos/RepAllContextsA.html\" " + "title=\"annotation in typeannos\">@RepAllContextsA</a> <a href=" @@ -604,7 +604,7 @@ + "\"../typeannos/RepAllContextsB.html\" title=\"annotation in typeannos\">" + "@RepAllContextsB</a> java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\">" + "<code><span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnMethod.html" - + "#test4--\">test4</a></span>​()</code>", + + "#test4--\">test4</a></span>()</code>", "<code><span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnMethod.html" + "#test5-java.lang.String-java.lang.String...-\">test5</a></span>" @@ -621,13 +621,13 @@ + "\"annotation in typeannos\">@RepMethodA</a>\n<a href=\"../typeannos/RepMethodB.html\"" + " title=\"annotation in typeannos\">@RepMethodB</a> <a href=" + "\"../typeannos/RepMethodB.html\" title=\"annotation in typeannos\">" - + "@RepMethodB</a>\njava.lang.String test1​()", + + "@RepMethodB</a>\njava.lang.String test1()", "<a href=\"../typeannos/RepTypeUseA.html\" title=\"annotation in typeannos\">" + "@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseA.html\" title=" + "\"annotation in typeannos\">@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseB.html\" " + "title=\"annotation in typeannos\">@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html\" " - + "title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String test2​()", + + "title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String test2()", "<a href=\"../typeannos/RepMethodA.html\" title=\"annotation in typeannos\">" + "@RepMethodA</a> <a href=\"../typeannos/RepMethodA.html\" title=" @@ -639,7 +639,7 @@ + "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href=" + "\"../typeannos/RepTypeUseB.html\" title=\"annotation in typeannos\">" + "@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html\" title=" - + "\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String test3​()", + + "\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String test3()", "<a href=\"../typeannos/RepAllContextsA.html\" title=\"annotation in typeannos\">" + "@RepAllContextsA</a> <a href=\"../typeannos/RepAllContextsA.html\" " @@ -652,7 +652,7 @@ + "title=\"annotation in typeannos\">@RepAllContextsA</a> <a href=" + "\"../typeannos/RepAllContextsB.html\" title=\"annotation in typeannos\">" + "@RepAllContextsB</a> <a href=\"../typeannos/RepAllContextsB.html\" " - + "title=\"annotation in typeannos\">@RepAllContextsB</a> java.lang.String test4​()", + + "title=\"annotation in typeannos\">@RepAllContextsB</a> java.lang.String test4()", "java.lang.String test5​(<a href=\"../typeannos/RepTypeUseA.html\" " + "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href=" @@ -697,7 +697,7 @@ "<code>(package private) java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\"><code>" + "<span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod.html#" - + "test--\">test</a></span>​()</code>", + + "test--\">test</a></span>()</code>", "java.lang.String test​(<a href=\"../typeannos/RepTypeUseA.html\" " + "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href=" @@ -718,6 +718,6 @@ + "\"annotation in typeannos\">@RepMethodA</a>\n<a href=\"../typeannos/RepMethodB.html" + "\" title=\"annotation in typeannos\">@RepMethodB</a> <a href=" + "\"../typeannos/RepMethodB.html\" title=\"annotation in typeannos\">" - + "@RepMethodB</a>\nvoid test​()"); + + "@RepMethodB</a>\nvoid test()"); } }
--- a/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java Thu Sep 28 22:15:46 2017 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200 + * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200 8186332 * @summary A simple test to ensure class-use files are correct. * @author jamieh * @library ../lib @@ -134,7 +134,7 @@ "<td class=\"colFirst\"><code>void</code></td>\n<th class=\"colSecond\" scope=\"row\"><span class=" + "\"typeNameLabel\">C1.</span><code><span class=\"memberNameLink\">" + "<a href=\"../../pkg1/C1.html#methodInC1ThrowsThrowable--\">methodInC1ThrowsThrowable" - + "</a></span>​()</code></th>" + + "</a></span>()</code></th>" ); }
--- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java Thu Sep 28 22:15:46 2017 +0200 @@ -41,6 +41,7 @@ public static void main(String... args) { testLatestSupported(); testVersionVaryingKeywords(); + testRestrictedKeywords(); } private static void testLatestSupported() { @@ -74,6 +75,27 @@ } } + private static void testRestrictedKeywords() { + // Restricted keywords are not full keywords + + /* + * JLS 3.9 + * " A further ten character sequences are restricted + * keywords: open, module, requires, transitive, exports, + * opens, to, uses, provides, and with" + */ + Set<String> restrictedKeywords = + Set.of("open", "module", "requires", "transitive", "exports", + "opens", "to", "uses", "provides", "with"); + + for(String key : restrictedKeywords) { + for(SourceVersion version : SourceVersion.values()) { + check(false, isKeyword(key, version), "keyword", version); + check(true, isName(key, version), "name", version); + } + } + } + private static void check(boolean result, boolean expected, String message, SourceVersion version) { if (result != expected) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/nashorn/script/basic/JDK-8186815.js Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2017, 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-8186815: Java.from has a bug, when element is ScriptObject + * + * @test + * @run + */ + +var list = new java.util.ArrayList(); +var obj = { x: 1 }; +list.add(obj); + +Assert.assertTrue(list.get(0) === obj); +Assert.assertTrue(list.get(0) instanceof Object); + +var fromList = Java.from(list); +Assert.assertTrue(fromList[0] === obj); +Assert.assertTrue(fromList[0] instanceof Object); + +var fromArray = Java.from(list.toArray()); +Assert.assertTrue(fromArray[0] === obj); +Assert.assertTrue(fromArray[0] instanceof Object);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/nashorn/script/basic/JDK-8187962.js Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017, 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-8187962: Optimistic types ignore JavaAdapter return types + * + * @test + * @run + */ + +function iterator() { + return null; +} + +var list = new java.util.List() { iterator: function() { return iterator(); }}; +var result = list.iterator(); +Assert.assertEquals(result, null); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/nashorn/script/basic/JDK-8188098.js Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2017, 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-8188098:NPE in SimpleTreeVisitorES6 visitor when parsing a tagged template literal + * + * @test + * @run + */ + +var Parser = Java.type("jdk.nashorn.api.tree.Parser"); +var MemberSelectTree = Java.type("jdk.nashorn.api.tree.MemberSelectTree"); +var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES6"); +var parser = Parser.create("--language=es6"); + +var ast = parser.parse("hello.js", "foo`PI (${Math.PI}) is transcendental`", print); + +var reachedCall = false; +ast.accept(new (Java.extend(SimpleTreeVisitor)) { + visitFunctionCall: function(node, extra) { + reachedCall = true; + Assert.assertTrue(node.functionSelect.name == "foo"); + var args = node.arguments; + Assert.assertTrue(args.size() == 2); + var strs = args.get(0).elements; + Assert.assertTrue(String(strs.get(0).value) == "PI ("); + Assert.assertTrue(String(strs.get(1).value) == ") is transcendental"); + var expr = args.get(1); + Assert.assertTrue(expr instanceof MemberSelectTree); + Assert.assertTrue(expr.expression.name == "Math"); + Assert.assertTrue(expr.identifier == "PI"); + } +}, null); + +Assert.assertTrue(reachedCall);
--- a/test/nashorn/script/currently-failing/JDK-8055034.js Wed Sep 27 12:57:41 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2014, 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-8055034: jjs exits interactive mode if exception was thrown when trying to print value of last evaluated expression - * - * @test - * @option -scripting - * @run - */ - -// assume that this script is run with "nashorn.jar" System -// property set to relative or absolute path of nashorn.jar - -if (typeof fail != 'function') { - fail = print; -} - -var System = java.lang.System; -var File = java.io.File; -var javahome = System.getProperty("java.home"); -var nashornJar = new File(System.getProperty("nashorn.jar")); -if (! nashornJar.isAbsolute()) { - nashornJar = new File(".", nashornJar); -} - -// we want to use nashorn.jar passed and not the one that comes with JRE -var jjsCmd = javahome + "/../bin/jjs"; -jjsCmd = jjsCmd.toString().replace(/\//g, File.separator); -if (! new File(jjsCmd).isFile()) { - jjsCmd = javahome + "/bin/jjs"; - jjsCmd = jjsCmd.toString().replace(/\//g, File.separator); -} -jjsCmd += " -J--patch-module=jdk.scripting.nashorn=" + nashornJar; - -$ENV.PWD=System.getProperty("user.dir") // to avoid RE on Cygwin -$EXEC(jjsCmd, "var x = Object.create(null);\nx;\nprint('PASSED');\nexit(0)"); - -// $ERR has all interactions including prompts! Just check for error substring. -var err = $ERR.trim(); -if (! err.contains("TypeError: Cannot get default string value")) { - fail("Error stream does not contain expected error message"); -} - -// should print "PASSED" -print($OUT.trim()); -// exit code should be 0 -print("exit code = " + $EXIT);
--- a/test/nashorn/script/currently-failing/JDK-8055034.js.EXPECTED Wed Sep 27 12:57:41 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -PASSED -exit code = 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/nashorn/script/nosecurity/JDK-8055034.js Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2017, 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-8055034: jjs exits interactive mode if exception was thrown when trying to print value of last evaluated expression + * + * @test + * @option -scripting + * @run + */ + +// assume that this script is run with "nashorn.jar" System +// property set to relative or absolute path of nashorn.jar + +if (typeof fail != 'function') { + fail = print; +} + +var System = java.lang.System; +var File = java.io.File; +var javahome = System.getProperty("java.home"); +var nashornJar = new File(System.getProperty("nashorn.jar")); +if (! nashornJar.isAbsolute()) { + nashornJar = new File(".", nashornJar); +} + +// we want to use nashorn.jar passed and not the one that comes with JRE +var jjsCmd = javahome + "/../bin/jjs"; +jjsCmd = jjsCmd.toString().replace(/\//g, File.separator); +if (! new File(jjsCmd).isFile()) { + jjsCmd = javahome + "/bin/jjs"; + jjsCmd = jjsCmd.toString().replace(/\//g, File.separator); +} +jjsCmd += " -J--patch-module=jdk.scripting.nashorn=" + nashornJar; + +$ENV.PWD=System.getProperty("user.dir") // to avoid RE on Cygwin +$EXEC(jjsCmd, "var x = Object.create(null);\nx;\nprint('PASSED');\nexit(0)"); + +// $ERR has all interactions including prompts! Just check for error substring. +var err = $ERR.trim(); +if (! err.contains("TypeError: Cannot get default string value")) { + fail("Error stream does not contain expected error message"); +} + +// should print "PASSED" +print($OUT.trim()); +// exit code should be 0 +print("exit code = " + $EXIT);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/nashorn/script/nosecurity/JDK-8055034.js.EXPECTED Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,6 @@ +jjs> var x = Object.create(null); +jjs> x; +jjs> print('PASSED'); +PASSED +jjs> exit(0) +exit code = 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/nashorn/src/jdk/nashorn/api/tree/test/JDK_8188098_Test.java Thu Sep 28 22:15:46 2017 +0200 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2017, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package jdk.nashorn.api.tree.test; + +import jdk.nashorn.api.tree.Parser; +import jdk.nashorn.api.tree.SimpleTreeVisitorES6; +import org.testng.annotations.Test; + +/** + * 8188098: NPE in SimpleTreeVisitorES6 visitor when parsing a tagged template literal + * + * @test + * @run testng jdk.nashorn.api.tree.test.JDK_8188098_Test + */ +public class JDK_8188098_Test { + @Test + public void test() { + Parser p = Parser.create("--language=es6"); + p.parse("test", "foo`hello world`", System.out::println). + accept(new SimpleTreeVisitorES6<Void, Void>(), null); + } +}
--- a/test/nashorn/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java Wed Sep 27 12:57:41 2017 +0100 +++ b/test/nashorn/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java Thu Sep 28 22:15:46 2017 +0200 @@ -28,6 +28,7 @@ @SuppressWarnings("javadoc") public class ClassWithFinalFinalizer { @Override + @SuppressWarnings("deprecation") protected final void finalize() { //empty }