From 680aa95dbb2a97f20a9ba6d59ab8bfb1c1ce75d5 Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Mon, 7 Nov 2016 14:36:27 -0400 Subject: [PATCH 01/54] 8155756: Better context for some jlink exceptions Reviewed-by: mchung --- .../share/classes/jdk/tools/jlink/internal/DirArchive.java | 2 +- .../share/classes/jdk/tools/jlink/internal/TaskHelper.java | 2 +- .../share/classes/jdk/tools/jlink/resources/jlink.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java index 7b8c2c88655..84fee1b4710 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java @@ -92,7 +92,7 @@ public class DirArchive implements Archive { public DirArchive(Path dirPath, Consumer log) { Objects.requireNonNull(dirPath); if (!Files.isDirectory(dirPath)) { - throw new IllegalArgumentException("Not a directory"); + throw new IllegalArgumentException(dirPath + " is not a directory"); } chop = dirPath.toString().length() + 1; this.moduleName = Objects.requireNonNull(dirPath.getFileName()).toString(); diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java index f5f74001d9c..083bf048724 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java @@ -212,7 +212,7 @@ public final class TaskHelper { mainOptions.add(new PlugOption(true, (task, opt, arg) -> { Path path = Paths.get(arg); if (!Files.exists(path) || !Files.isDirectory(path)) { - throw newBadArgs("err.image.must.exist"); + throw newBadArgs("err.image.must.exist", path); } existingImage = path.toAbsolutePath(); }, true, POST_PROCESS)); diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties index 556e0b20c66..ac4a86293a6 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties @@ -91,7 +91,7 @@ err.modulepath.must.be.specified:--module-path must be specified err.mods.must.be.specified:no modules specified to {0} err.path.not.found=path not found: {0} err.path.not.valid=invalid path: {0} -err.image.must.exist=image does not exist or is not a directory +err.image.must.exist=image {0} does not exist or is not a directory err.existing.image.invalid=existing image is not valid err.file.not.found=cannot find file: {0} err.file.error=cannot access file: {0} From f683694e4f7f0c7884ac6f9a921c2e611a285151 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Tue, 8 Nov 2016 06:22:31 +0000 Subject: [PATCH 02/54] 8169318: Dump the reproduced packet in DTLSOverDatagram.java Reviewed-by: mullan --- jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java b/jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java index 10886497267..9c938090750 100644 --- a/jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java +++ b/jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java @@ -176,7 +176,10 @@ public class DTLSOverDatagram { boolean finished = onReceiveTimeout( engine, peerAddr, side, packets); + log(side, "Reproduced " + packets.size() + " packets"); for (DatagramPacket p : packets) { + printHex("Reproduced packet", + p.getData(), p.getOffset(), p.getLength()); socket.send(p); } @@ -334,7 +337,7 @@ public class DTLSOverDatagram { String side, List packets) throws Exception { boolean endLoops = false; - int loops = MAX_HANDSHAKE_LOOPS; + int loops = MAX_HANDSHAKE_LOOPS / 2; while (!endLoops && (serverException == null) && (clientException == null)) { @@ -350,7 +353,8 @@ public class DTLSOverDatagram { SSLEngineResult.Status rs = r.getStatus(); SSLEngineResult.HandshakeStatus hs = r.getHandshakeStatus(); - log(side, "====packet(" + loops + ", " + rs + ", " + hs + ")===="); + log(side, "----produce handshake packet(" + + loops + ", " + rs + ", " + hs + ")----"); if (rs == SSLEngineResult.Status.BUFFER_OVERFLOW) { // the client maximum fragment size config does not work? throw new Exception("Buffer overflow: " + From c8aad861dcaa92bc7d7295ae09ea132b3dc51976 Mon Sep 17 00:00:00 2001 From: Nishit Jain Date: Tue, 8 Nov 2016 14:48:55 +0530 Subject: [PATCH 03/54] 8166994: Improve sun.util.locale.LocaleMatcher Reviewed-by: okutsu, naoto, peytoia --- .../sun/util/locale/LocaleMatcher.java | 34 +++++++-- jdk/test/java/util/Locale/Bug8166994.java | 74 +++++++++++++++++++ 2 files changed, 101 insertions(+), 7 deletions(-) create mode 100644 jdk/test/java/util/Locale/Bug8166994.java diff --git a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java index 3af00e4ce9e..8426b264621 100644 --- a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java +++ b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java @@ -365,7 +365,7 @@ public final class LocaleMatcher { continue; } - String rangeForRegex = range.replaceAll("\\x2A", "\\\\p{Alnum}*"); + String rangeForRegex = range.replace("*", "\\p{Alnum}*"); while (rangeForRegex.length() > 0) { for (String tag : tags) { tag = tag.toLowerCase(Locale.ROOT); @@ -399,7 +399,7 @@ public final class LocaleMatcher { continue; } - String rangeForRegex = range.replaceAll("\\x2A", "\\\\p{Alnum}*"); + String rangeForRegex = range.replace("*", "\\p{Alnum}*"); while (rangeForRegex.length() > 0) { if (tag.matches(rangeForRegex)) { return true; @@ -447,7 +447,7 @@ public final class LocaleMatcher { } public static List parse(String ranges) { - ranges = ranges.replaceAll(" ", "").toLowerCase(Locale.ROOT); + ranges = ranges.replace(" ", "").toLowerCase(Locale.ROOT); if (ranges.startsWith("accept-language:")) { ranges = ranges.substring(16); // delete unnecessary prefix } @@ -536,6 +536,21 @@ public final class LocaleMatcher { return list; } + /** + * A faster alternative approach to String.replaceFirst(), if the given + * string is a literal String, not a regex. + */ + private static String replaceFirstSubStringMatch(String range, + String substr, String replacement) { + int pos = range.indexOf(substr); + if (pos == -1) { + return range; + } else { + return range.substring(0, pos) + replacement + + range.substring(pos + substr.length()); + } + } + private static String[] getEquivalentsForLanguage(String range) { String r = range; @@ -544,13 +559,16 @@ public final class LocaleMatcher { String equiv = LocaleEquivalentMaps.singleEquivMap.get(r); // Return immediately for performance if the first matching // subtag is found. - return new String[] {range.replaceFirst(r, equiv)}; + return new String[]{replaceFirstSubStringMatch(range, + r, equiv)}; } else if (LocaleEquivalentMaps.multiEquivsMap.containsKey(r)) { String[] equivs = LocaleEquivalentMaps.multiEquivsMap.get(r); + String[] result = new String[equivs.length]; for (int i = 0; i < equivs.length; i++) { - equivs[i] = range.replaceFirst(r, equivs[i]); + result[i] = replaceFirstSubStringMatch(range, + r, equivs[i]); } - return equivs; + return result; } // Truncate the last subtag simply. @@ -578,7 +596,9 @@ public final class LocaleMatcher { int len = index + subtag.length(); if (range.length() == len || range.charAt(len) == '-') { - return range.replaceFirst(subtag, LocaleEquivalentMaps.regionVariantEquivMap.get(subtag)); + return replaceFirstSubStringMatch(range, subtag, + LocaleEquivalentMaps.regionVariantEquivMap + .get(subtag)); } } } diff --git a/jdk/test/java/util/Locale/Bug8166994.java b/jdk/test/java/util/Locale/Bug8166994.java new file mode 100644 index 00000000000..7dea676107a --- /dev/null +++ b/jdk/test/java/util/Locale/Bug8166994.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016, 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 8166884 + * @summary Checks the subsequent call to parse the same language ranges + * which must generate the same list of language ranges + * i.e. the priority list containing equivalents, as in the + * first call + */ + +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; + +public class Bug8166994 { + + public static void main(String[] args) { + List list = Arrays.asList("ccq-aa", "ybd-aa", "rki-aa"); + String ranges = "ccq-aa"; + testParseConsistency(list, ranges); + + // consecutive call to check the language range parse consistency + testParseConsistency(list, ranges); + + // another case with ranges consisting of multiple equivalents and + // single equivalents + list = Arrays.asList("gfx-xz", "oun-xz", "mwj-xz", "vaj-xz", + "taj-xy", "tsf-xy"); + ranges = "gfx-xz, taj-xy"; + testParseConsistency(list, ranges); + // consecutive call to check the language range parse consistency + testParseConsistency(list, ranges); + + } + + private static void testParseConsistency(List list, String ranges) { + List priorityList = parseRanges(ranges); + if (!list.equals(priorityList)) { + throw new RuntimeException("Failed to parse the language range [" + + ranges + "], Expected: " + list + " Found: " + + priorityList); + } + } + + private static List parseRanges(String s) { + return Locale.LanguageRange.parse(s).stream() + .map(Locale.LanguageRange::getRange) + .collect(Collectors.toList()); + } + +} + From a13cbb364c6f409955319b48db636b62c2ec5d85 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Tue, 8 Nov 2016 13:23:16 +0100 Subject: [PATCH 04/54] 8168911: Increased number of classes initialized during initialization of SignatureFileVerifier Reviewed-by: ascarpino --- .../util/AbstractAlgorithmConstraints.java | 8 +++-- .../security/util/AlgorithmDecomposer.java | 16 ++++----- .../util/DisabledAlgorithmConstraints.java | 36 ++++++++++++------- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java b/jdk/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java index 3c0b1324109..2f7bc0c16af 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java +++ b/jdk/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java @@ -46,8 +46,12 @@ public abstract class AbstractAlgorithmConstraints // Get algorithm constraints from the specified security property. static String[] getAlgorithms(String propertyName) { String property = AccessController.doPrivileged( - (PrivilegedAction) () -> Security.getProperty( - propertyName)); + new PrivilegedAction() { + @Override + public String run() { + return Security.getProperty(propertyName); + } + }); String[] algorithmsInProperty = null; if (property != null && !property.isEmpty()) { diff --git a/jdk/src/java.base/share/classes/sun/security/util/AlgorithmDecomposer.java b/jdk/src/java.base/share/classes/sun/security/util/AlgorithmDecomposer.java index bff76cf1721..1774cabb8fb 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/AlgorithmDecomposer.java +++ b/jdk/src/java.base/share/classes/sun/security/util/AlgorithmDecomposer.java @@ -34,20 +34,18 @@ import java.util.regex.Pattern; */ public class AlgorithmDecomposer { - private static final Pattern transPattern = Pattern.compile("/"); - // '(? decomposeImpl(String algorithm) { + Set elements = new HashSet<>(); // algorithm/mode/padding - String[] transTockens = transPattern.split(algorithm); + String[] transTokens = algorithm.split("/"); - Set elements = new HashSet<>(); - for (String transTocken : transTockens) { - if (transTocken == null || transTocken.length() == 0) { + for (String transToken : transTokens) { + if (transToken == null || transToken.isEmpty()) { continue; } @@ -57,10 +55,10 @@ public class AlgorithmDecomposer { // with // withand // within - String[] tokens = pattern.split(transTocken); + String[] tokens = PATTERN.split(transToken); for (String token : tokens) { - if (token == null || token.length() == 0) { + if (token == null || token.isEmpty()) { continue; } diff --git a/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java b/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java index 737d68f4881..73914fe30ae 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java +++ b/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java @@ -39,6 +39,7 @@ import java.util.HashSet; import java.util.Locale; import java.util.Map; import java.util.Set; +import java.util.StringTokenizer; import java.util.TimeZone; import java.util.regex.Pattern; import java.util.regex.Matcher; @@ -240,10 +241,11 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { private static class Constraints { private Map> constraintsMap = new HashMap<>(); - private static final Pattern keySizePattern = Pattern.compile( - "keySize\\s*(<=|<|==|!=|>|>=)\\s*(\\d+)"); - private static final Pattern denyAfterPattern = Pattern.compile( - "denyAfter\\s+(\\d{4})-(\\d{2})-(\\d{2})"); + + private static class Holder { + private static final Pattern DENY_AFTER_PATTERN = Pattern.compile( + "denyAfter\\s+(\\d{4})-(\\d{2})-(\\d{2})"); + } public Constraints(String[] constraintArray) { for (String constraintEntry : constraintArray) { @@ -267,9 +269,11 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { toUpperCase(Locale.ENGLISH)); policy = constraintEntry.substring(space + 1); } else { - constraintsMap.computeIfAbsent( - constraintEntry.toUpperCase(Locale.ENGLISH), - k -> new HashSet<>()); + algorithm = constraintEntry.toUpperCase(Locale.ENGLISH); + if (!constraintsMap.containsKey(algorithm)) { + constraintsMap.putIfAbsent(algorithm, + new HashSet<>()); + } continue; } @@ -283,15 +287,21 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { for (String entry : policy.split("&")) { entry = entry.trim(); - Matcher matcher = keySizePattern.matcher(entry); - if (matcher.matches()) { + Matcher matcher; + if (entry.startsWith("keySize")) { if (debug != null) { debug.println("Constraints set to keySize: " + entry); } + StringTokenizer tokens = new StringTokenizer(entry); + if (!"keySize".equals(tokens.nextToken())) { + throw new IllegalArgumentException("Error in " + + "security property. Constraint unknown: " + + entry); + } c = new KeySizeConstraint(algorithm, - KeySizeConstraint.Operator.of(matcher.group(1)), - Integer.parseInt(matcher.group(2))); + KeySizeConstraint.Operator.of(tokens.nextToken()), + Integer.parseInt(tokens.nextToken())); } else if (entry.equalsIgnoreCase("jdkCA")) { if (debug != null) { @@ -305,7 +315,9 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { c = new jdkCAConstraint(algorithm); jdkCALimit = true; - } else if(matcher.usePattern(denyAfterPattern).matches()) { + } else if(entry.startsWith("denyAfter") && + (matcher = Holder.DENY_AFTER_PATTERN.matcher(entry)) + .matches()) { if (debug != null) { debug.println("Constraints set to denyAfter"); } From 060ce7c7391a86cff24cdac8a35111bdc95f408d Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Tue, 8 Nov 2016 12:36:13 -0800 Subject: [PATCH 05/54] 8165782: java.util.jar.JarFile.runtimeVersion() spec needs clarification Reviewed-by: mchung, alanb --- .../share/classes/java/util/jar/JarFile.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java index 6b3abf50d78..b3c69df7892 100644 --- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java @@ -192,9 +192,10 @@ class JarFile extends ZipFile { public static final String MANIFEST_NAME = META_INF + "MANIFEST.MF"; /** - * The version that represents the unversioned configuration of a multi-release jar file. + * Returns the version that represents the unversioned configuration of a + * multi-release jar file. * - * @return Runtime.Version that represents the unversioned configuration + * @return the version that represents the unversioned configuration * * @since 9 */ @@ -203,13 +204,16 @@ class JarFile extends ZipFile { } /** - * The version that represents the effective runtime versioned configuration of a - * multi-release jar file. In most cases, {@code runtimeVersion()} is equal to - * {@code Runtime.version()}. However, if the {@code jdk.util.jar.version} property is set, - * {@code runtimeVersion()} is derived from that property and may not be equal to - * {@code Runtime.version()}. + * Returns the version that represents the effective runtime versioned + * configuration of a multi-release jar file. + *

+ * By default the major version number of the returned {@code Version} will + * be equal to the major version number of {@code Runtime.version()}. + * However, if the {@code jdk.util.jar.version} property is set, the + * returned {@code Version} is derived from that property and major version + * numbers may not be equal. * - * @return Runtime.Version that represents the runtime versioned configuration + * @return the version that represents the runtime versioned configuration * * @since 9 */ From e7fe2a82ca2e5ee190569a7bfaaae6e079f1f6f7 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Tue, 8 Nov 2016 12:36:21 -0800 Subject: [PATCH 06/54] 8166735: JarFile#getVersion spec clarification for unversioned jars Reviewed-by: mchung, alanb --- jdk/src/java.base/share/classes/java/util/jar/JarFile.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java index b3c69df7892..abf4b2fefab 100644 --- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java @@ -339,6 +339,10 @@ class JarFile extends ZipFile { /** * Returns the maximum version used when searching for versioned entries. + *

+ * If this {@code JarFile} is not a multi-release jar file or is not + * configured to be processed as such, then the version returned will be the + * same as that returned from {@link #baseVersion()}. * * @return the maximum version * @since 9 From 398942a17f06f5a8b080961fe10d17ce855c3be0 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Tue, 8 Nov 2016 14:29:14 -0800 Subject: [PATCH 07/54] 8168862: Tighten permissions granted to the jdk.zipfs module Reviewed-by: mullan, mchung, lancea, bpb --- jdk/src/java.base/share/lib/security/default.policy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/lib/security/default.policy b/jdk/src/java.base/share/lib/security/default.policy index 966898459a7..74c8463ea3c 100644 --- a/jdk/src/java.base/share/lib/security/default.policy +++ b/jdk/src/java.base/share/lib/security/default.policy @@ -181,6 +181,6 @@ grant codeBase "jrt:/jdk.security.jgss" { grant codeBase "jrt:/jdk.zipfs" { permission java.io.FilePermission "<>", "read,write,delete"; permission java.lang.RuntimePermission "fileSystemProvider"; - permission java.util.PropertyPermission "*", "read"; + permission java.util.PropertyPermission "os.name", "read"; }; From 31c4b07045bc6a4b220d389430715e9dbb09bbb3 Mon Sep 17 00:00:00 2001 From: Artem Smotrakov Date: Tue, 8 Nov 2016 15:55:11 -0800 Subject: [PATCH 08/54] 8168882: keytool doesn't print certificate info if disabled algorithm was used for signing a jar Reviewed-by: weijun, mullan --- .../sun/security/tools/keytool/Main.java | 8 +- jdk/test/lib/security/SecurityTools.java | 122 ++++++++++++++++++ .../security/tools/keytool/KeyToolTest.java | 10 +- .../sun/security/tools/keytool/PrintSSL.java | 27 +++- .../sun/security/tools/keytool/ReadJar.java | 86 ++++++++++++ .../sun/security/tools/keytool/readjar.sh | 57 -------- 6 files changed, 244 insertions(+), 66 deletions(-) create mode 100644 jdk/test/lib/security/SecurityTools.java create mode 100644 jdk/test/sun/security/tools/keytool/ReadJar.java delete mode 100644 jdk/test/sun/security/tools/keytool/readjar.sh diff --git a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java index 6e26cc62128..9730938c927 100644 --- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java +++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -84,8 +84,10 @@ import sun.security.util.Pem; import sun.security.x509.*; import static java.security.KeyStore.*; +import java.security.Security; import static sun.security.tools.keytool.Main.Command.*; import static sun.security.tools.keytool.Main.Option.*; +import sun.security.util.DisabledAlgorithmConstraints; /** * This tool manages keystores. @@ -2428,6 +2430,10 @@ public final class Main { private void doPrintCert(final PrintStream out) throws Exception { if (jarfile != null) { + // reset "jdk.certpath.disabledAlgorithms" security property + // to be able to read jars which were signed with weak algorithms + Security.setProperty(DisabledAlgorithmConstraints.PROPERTY_JAR_DISABLED_ALGS, ""); + JarFile jf = new JarFile(jarfile, true); Enumeration entries = jf.entries(); Set ss = new HashSet<>(); diff --git a/jdk/test/lib/security/SecurityTools.java b/jdk/test/lib/security/SecurityTools.java new file mode 100644 index 00000000000..601aa8a999c --- /dev/null +++ b/jdk/test/lib/security/SecurityTools.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import jdk.testlibrary.JDKToolLauncher; +import jdk.testlibrary.OutputAnalyzer; +import jdk.testlibrary.ProcessTools; + +public class SecurityTools { + + public static final String NO_ALIAS = null; + + // keytool + + public static OutputAnalyzer keytool(List options) + throws Throwable { + + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("keytool") + .addVMArg("-Duser.language=en") + .addVMArg("-Duser.country=US"); + for (String option : options) { + if (option.startsWith("-J")) { + launcher.addVMArg(option.substring(2)); + } else { + launcher.addToolArg(option); + } + } + return ProcessTools.executeCommand(launcher.getCommand()); + } + + public static OutputAnalyzer keytool(String options) throws Throwable { + return keytool(options.split("\\s+")); + } + + public static OutputAnalyzer keytool(String... options) throws Throwable { + return keytool(List.of(options)); + } + + // jarsigner + + public static OutputAnalyzer jarsigner(String jar, String alias, + List options) throws Throwable { + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jarsigner") + .addVMArg("-Duser.language=en") + .addVMArg("-Duser.country=US"); + for (String option : options) { + if (option.startsWith("-J")) { + launcher.addVMArg(option.substring(2)); + } else { + launcher.addToolArg(option); + } + } + launcher.addToolArg(jar); + if (alias != null) { + launcher.addToolArg(alias); + } + return ProcessTools.executeCommand(launcher.getCommand()); + } + + public static OutputAnalyzer jarsigner(String jar, String alias, + String options) throws Throwable { + + return jarsigner(jar, alias, options.split("\\s+")); + } + + public static OutputAnalyzer jarsigner(String jar, String alias, + String... options) throws Throwable { + + return jarsigner(jar, alias, List.of(options)); + } + + public static OutputAnalyzer sign(String jar, String alias, String... options) + throws Throwable { + + return jarsigner(jar, alias, + mergeOptions("-J-Djava.security.egd=file:/dev/./urandom", options)); + } + + public static OutputAnalyzer verify(String jar, String... options) + throws Throwable { + + return jarsigner(jar, NO_ALIAS, mergeOptions("-verify", options)); + } + + // helper methods + + private static List mergeOptions( + String firstOption, String... secondPart) { + + return mergeOptions(List.of(firstOption), secondPart); + } + + private static List mergeOptions( + List firstPart, String... secondPart) { + + List options = new ArrayList<>(firstPart); + Collections.addAll(options, secondPart); + return options; + } +} diff --git a/jdk/test/sun/security/tools/keytool/KeyToolTest.java b/jdk/test/sun/security/tools/keytool/KeyToolTest.java index 7e19d510767..4a58232a27f 100644 --- a/jdk/test/sun/security/tools/keytool/KeyToolTest.java +++ b/jdk/test/sun/security/tools/keytool/KeyToolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, 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 @@ -1211,18 +1211,26 @@ public class KeyToolTest { void sqePrintcertTest() throws Exception { remove("x.jks"); remove("mykey.cert"); + remove("myweakkey.cert"); testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + "-keypass changeit -genkeypair -dname CN=olala"); testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + "-export -file mykey.cert -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=weak -keyalg rsa " + + "-keysize 512 -sigalg MD5withRSA -alias myweakkey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-export -file myweakkey.cert -alias myweakkey"); testFail("", "-printcert -file badkeystore"); testFail("", "-printcert -file a/b/c/d"); testOK("", "-printcert -file mykey.cert"); + testOK("", "-printcert -file myweakkey.cert"); FileInputStream fin = new FileInputStream("mykey.cert"); testOK(fin, "-printcert"); fin.close(); remove("x.jks"); remove("mykey.cert"); + remove("myweakkey.cert"); } // 8074935: jdk8 keytool doesn't validate pem files for RFC 1421 correctness diff --git a/jdk/test/sun/security/tools/keytool/PrintSSL.java b/jdk/test/sun/security/tools/keytool/PrintSSL.java index 04684f65998..2e600fcd0e5 100644 --- a/jdk/test/sun/security/tools/keytool/PrintSSL.java +++ b/jdk/test/sun/security/tools/keytool/PrintSSL.java @@ -24,20 +24,32 @@ /* * @test * @bug 6480981 8160624 - * @modules java.base/sun.security.tools.keytool * @summary keytool should be able to import certificates from remote SSL server + * @library /lib/security + * @library /lib/testlibrary * @run main/othervm PrintSSL */ -import java.io.IOException; import java.net.ServerSocket; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.concurrent.CountDownLatch; import javax.net.ssl.SSLServerSocketFactory; import javax.net.ssl.SSLSocket; +import jdk.testlibrary.OutputAnalyzer; public class PrintSSL { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws Throwable { + Files.deleteIfExists(Paths.get("keystore")); + + // make sure that "-printcert" works with weak algorithms + OutputAnalyzer out = SecurityTools.keytool("-genkeypair " + + "-keystore keystore -storepass passphrase " + + "-keypass passphrase -keyalg rsa -keysize 512 " + + "-sigalg MD5withRSA -alias rsa_alias -dname CN=Server"); + System.out.println(out.getOutput()); + out.shouldHaveExitValue(0); int port = new Server().start(); if(port == -1) { @@ -47,7 +59,10 @@ public class PrintSSL { String cmd = String.format( "-debug %s -printcert -sslserver localhost:%s", ((vmOpt == null) ? "" : vmOpt ), port); - sun.security.tools.keytool.Main.main(cmd.split("\\s+")); + + out = SecurityTools.keytool(cmd); + System.out.println(out.getOutput()); + out.shouldHaveExitValue(0); } private static class Server implements Runnable { @@ -68,9 +83,7 @@ public class PrintSSL { public void run() { System.setProperty("javax.net.ssl.keyStorePassword", "passphrase"); - System.setProperty("javax.net.ssl.keyStore", - System.getProperty("test.src", "./") - + "/../../../../javax/net/ssl/etc/keystore"); + System.setProperty("javax.net.ssl.keyStore", "keystore"); SSLServerSocketFactory sslssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault(); try (ServerSocket server = sslssf.createServerSocket(0)) { diff --git a/jdk/test/sun/security/tools/keytool/ReadJar.java b/jdk/test/sun/security/tools/keytool/ReadJar.java new file mode 100644 index 00000000000..9e6739cc68b --- /dev/null +++ b/jdk/test/sun/security/tools/keytool/ReadJar.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016, 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 6890872 8168882 + * @summary keytool -printcert to recognize signed jar files + * @library /lib/security + * @library /lib/testlibrary + */ + +import java.nio.file.Files; +import java.nio.file.Paths; +import jdk.testlibrary.JarUtils; +import jdk.testlibrary.OutputAnalyzer; + +public class ReadJar { + + public static void main(String[] args) throws Throwable { + testWithMD5(); + } + + // make sure that -printcert option works + // if a weak algorithm was used for signing a jar + private static void testWithMD5() throws Throwable { + // create jar files + JarUtils.createJar("test_md5.jar", "test"); + JarUtils.createJar("test_rsa.jar", "test"); + + // create a keystore and generate keys for jar signing + Files.deleteIfExists(Paths.get("keystore")); + + OutputAnalyzer out = SecurityTools.keytool("-genkeypair " + + "-keystore keystore -storepass password " + + "-keypass password -keyalg rsa -alias rsa_alias -dname CN=A"); + System.out.println(out.getOutput()); + out.shouldHaveExitValue(0); + + out = SecurityTools.jarsigner("test_rsa.jar", "rsa_alias", + "-keystore keystore -storepass password "); + System.out.println(out.getOutput()); + out.shouldHaveExitValue(0); + + printCert("test_rsa.jar"); + + out = SecurityTools.jarsigner("test_md5.jar", "rsa_alias", + "-keystore keystore -storepass password " + + "-sigalg MD5withRSA -digestalg MD5"); + System.out.println(out.getOutput()); + out.shouldHaveExitValue(0); + + printCert("test_md5.jar"); + } + + private static void printCert(String jar) throws Throwable { + OutputAnalyzer out = SecurityTools.keytool("-printcert -jarfile " + jar); + System.out.println(out.getOutput()); + out.shouldHaveExitValue(0); + out.shouldNotContain("Not a signed jar file"); + + out = SecurityTools.keytool("-printcert -rfc -jarfile " + jar); + System.out.println(out.getOutput()); + out.shouldHaveExitValue(0); + out.shouldNotContain("Not a signed jar file"); + } +} diff --git a/jdk/test/sun/security/tools/keytool/readjar.sh b/jdk/test/sun/security/tools/keytool/readjar.sh deleted file mode 100644 index b041924e0d9..00000000000 --- a/jdk/test/sun/security/tools/keytool/readjar.sh +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# @test -# @bug 6890872 -# @summary keytool -printcert to recognize signed jar files -# - -if [ "${TESTJAVA}" = "" ] ; then - JAVAC_CMD=`which javac` - TESTJAVA=`dirname $JAVAC_CMD`/.. - COMPILEJAVA=${TESTJAVA} -fi - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Windows_* ) - FS="\\" - ;; - * ) - FS="/" - ;; -esac - -KS=readjar.jks -rm $KS -$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit -keystore $KS \ - -keyalg rsa -alias x -dname CN=X -genkeypair -$COMPILEJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS} cvf readjar.jar $KS -$COMPILEJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -storepass changeit -keystore $KS readjar.jar x - -$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -printcert -jarfile readjar.jar || exit 1 -$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -printcert -jarfile readjar.jar -rfc || exit 1 - -exit 0 - From 5e03e2fcd5edb344250443db6a68696986824e43 Mon Sep 17 00:00:00 2001 From: Bradford Wetmore Date: Tue, 8 Nov 2016 16:54:28 -0800 Subject: [PATCH 09/54] 8169229: RSAClientKeyExchange debug info is incorrect Reviewed-by: xuelei --- .../classes/sun/security/ssl/RSAClientKeyExchange.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java index 6cb2b650de5..98504af5536 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java @@ -257,7 +257,13 @@ final class RSAClientKeyExchange extends HandshakeMessage { @Override void print(PrintStream s) throws IOException { - s.println("*** ClientKeyExchange, RSA PreMasterSecret, " + - protocolVersion); + String version = "version not available/extractable"; + + byte[] ba = preMaster.getEncoded(); + if (ba != null && ba.length >= 2) { + version = ProtocolVersion.valueOf(ba[0], ba[1]).name; + } + + s.println("*** ClientKeyExchange, RSA PreMasterSecret, " + version); } } From d0b96b7e6a1cb491f036d7b44fda0a12e964a275 Mon Sep 17 00:00:00 2001 From: Ramanand Patil Date: Tue, 8 Nov 2016 18:02:50 +0530 Subject: [PATCH 10/54] 8169191: (tz) Support tzdata2016i Reviewed-by: martin, okutsu --- jdk/make/data/tzdata/VERSION | 2 +- jdk/make/data/tzdata/antarctica | 7 +- jdk/make/data/tzdata/asia | 17 ++- jdk/make/data/tzdata/australasia | 18 ++- jdk/make/data/tzdata/europe | 143 ++++++++++-------- jdk/make/data/tzdata/zone.tab | 3 +- jdk/test/sun/util/calendar/zi/tzdata/VERSION | 2 +- .../sun/util/calendar/zi/tzdata/antarctica | 7 +- jdk/test/sun/util/calendar/zi/tzdata/asia | 17 ++- .../sun/util/calendar/zi/tzdata/australasia | 18 ++- jdk/test/sun/util/calendar/zi/tzdata/europe | 143 ++++++++++-------- jdk/test/sun/util/calendar/zi/tzdata/zone.tab | 3 +- 12 files changed, 232 insertions(+), 148 deletions(-) diff --git a/jdk/make/data/tzdata/VERSION b/jdk/make/data/tzdata/VERSION index 7009f248679..3fbffda8d33 100644 --- a/jdk/make/data/tzdata/VERSION +++ b/jdk/make/data/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2016h +tzdata2016i diff --git a/jdk/make/data/tzdata/antarctica b/jdk/make/data/tzdata/antarctica index f96947abc7c..2398ac51b07 100644 --- a/jdk/make/data/tzdata/antarctica +++ b/jdk/make/data/tzdata/antarctica @@ -87,13 +87,18 @@ # Background: # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html +# From Steffen Thorsen (2016-10-28): +# Australian Antarctica Division informed us that Casey changed time +# zone to UTC+11 in "the morning of 22nd October 2016". + # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2009 Oct 18 2:00 11:00 - +11 2010 Mar 5 2:00 8:00 - +08 2011 Oct 28 2:00 11:00 - +11 2012 Feb 21 17:00u - 8:00 - +08 + 8:00 - +08 2016 Oct 22 + 11:00 - +11 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb diff --git a/jdk/make/data/tzdata/asia b/jdk/make/data/tzdata/asia index 71711a946d1..7d540324cdb 100644 --- a/jdk/make/data/tzdata/asia +++ b/jdk/make/data/tzdata/asia @@ -794,9 +794,19 @@ Zone Asia/Macau 7:34:20 - LMT 1912 Jan 1 ############################################################################### # Cyprus -# + # Milne says the Eastern Telegraph Company used 2:14:00. Stick with LMT. +# IATA SSIM (1998-09) has Cyprus using EU rules for the first time. + +# From Paul Eggert (2016-09-09): +# Yesterday's Cyprus Mail reports that Northern Cyprus followed Turkey's +# lead and switched from +02/+03 to +03 year-round. +# http://cyprus-mail.com/2016/09/08/two-time-zones-cyprus-turkey-will-not-turn-clocks-back-next-month/ # +# From Even Scharning (2016-10-31): +# Looks like the time zone split in Cyprus went through last night. +# http://cyprus-mail.com/2016/10/30/cyprus-new-division-two-time-zones-now-reality/ + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Cyprus 1975 only - Apr 13 0:00 1:00 S Rule Cyprus 1975 only - Oct 12 0:00 0 - @@ -811,7 +821,10 @@ Rule Cyprus 1981 1998 - Mar lastSun 0:00 1:00 S Zone Asia/Nicosia 2:13:28 - LMT 1921 Nov 14 2:00 Cyprus EE%sT 1998 Sep 2:00 EUAsia EE%sT -# IATA SSIM (1998-09) has Cyprus using EU rules for the first time. +Zone Asia/Famagusta 2:15:48 - LMT 1921 Nov 14 + 2:00 Cyprus EE%sT 1998 Sep + 2:00 EUAsia EE%sT 2016 Sep 8 + 3:00 - +03 # Classically, Cyprus belongs to Asia; e.g. see Herodotus, Histories, I.72. # However, for various reasons many users expect to find it under Europe. diff --git a/jdk/make/data/tzdata/australasia b/jdk/make/data/tzdata/australasia index 23153b171fa..81ef5215942 100644 --- a/jdk/make/data/tzdata/australasia +++ b/jdk/make/data/tzdata/australasia @@ -725,11 +725,13 @@ Rule Tonga 1999 only - Oct 7 2:00s 1:00 S Rule Tonga 2000 only - Mar 19 2:00s 0 - Rule Tonga 2000 2001 - Nov Sun>=1 2:00 1:00 S Rule Tonga 2001 2002 - Jan lastSun 2:00 0 - +Rule Tonga 2016 max - Nov Sun>=1 2:00 1:00 S +Rule Tonga 2017 max - Jan Sun>=15 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Tongatapu 12:19:20 - LMT 1901 - 12:20 - TOT 1941 # Tonga Time - 13:00 - TOT 1999 - 13:00 Tonga TO%sT + 12:20 - +1220 1941 + 13:00 - +13 1999 + 13:00 Tonga +13/+14 # Tuvalu # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -1735,9 +1737,17 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # of January the standard time in the Kingdom shall be moved backward by one # hour to 1:00am. -# From Pulu 'Anau (2002-11-05): +# From Pulu ʻAnau (2002-11-05): # The law was for 3 years, supposedly to get renewed. It wasn't. +# From Pulu ʻAnau (2016-10-27): +# http://mic.gov.to/news-today/press-releases/6375-daylight-saving-set-to-run-from-6-november-2016-to-15-january-2017 +# Cannot find anyone who knows the rules, has seen the duration or has seen +# the cabinet decision, but it appears we are following Fiji's rule set. +# +# From Tim Parenti (2016-10-26): +# Assume Tonga will observe DST from the first Sunday in November at 02:00 +# through the third Sunday in January at 03:00, like Fiji, for now. # Wake diff --git a/jdk/make/data/tzdata/europe b/jdk/make/data/tzdata/europe index d182dbb6ba8..df464859fb3 100644 --- a/jdk/make/data/tzdata/europe +++ b/jdk/make/data/tzdata/europe @@ -1523,73 +1523,84 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # But these events all occurred before the 1970 cutoff, # so record only the time in Rome. # -# From Paul Eggert (2006-03-22): -# For Italian DST we have three sources: Shanks & Pottenger, Whitman, and -# F. Pollastri -# Day-light Saving Time in Italy (2006-02-03) -# http://toi.iriti.cnr.it/uk/ienitlt.html -# ('FP' below), taken from an Italian National Electrotechnical Institute -# publication. When the three sources disagree, guess who's right, as follows: +# From Michael Deckers (2016-10-24): +# http://www.ac-ilsestante.it/MERIDIANE/ora_legale quotes a law of 1893-08-10 +# ... [translated as] "The preceding dispositions will enter into +# force at the instant at which, according to the time specified in +# the 1st article, the 1st of November 1893 will begin...." # -# year FP Shanks&P. (S) Whitman (W) Go with: -# 1916 06-03 06-03 24:00 06-03 00:00 FP & W -# 09-30 09-30 24:00 09-30 01:00 FP; guess 24:00s -# 1917 04-01 03-31 24:00 03-31 00:00 FP & S -# 09-30 09-29 24:00 09-30 01:00 FP & W -# 1918 03-09 03-09 24:00 03-09 00:00 FP & S -# 10-06 10-05 24:00 10-06 01:00 FP & W -# 1919 03-01 03-01 24:00 03-01 00:00 FP & S -# 10-04 10-04 24:00 10-04 01:00 FP; guess 24:00s -# 1920 03-20 03-20 24:00 03-20 00:00 FP & S -# 09-18 09-18 24:00 10-01 01:00 FP; guess 24:00s -# 1944 04-02 04-03 02:00 S (see C-Eur) -# 09-16 10-02 03:00 FP; guess 24:00s -# 1945 09-14 09-16 24:00 FP; guess 24:00s -# 1970 05-21 05-31 00:00 S -# 09-20 09-27 00:00 S +# From Pierpaolo Bernardi (2016-10-20): +# The authoritative source for time in Italy is the national metrological +# institute, which has a summary page of historical DST data at +# http://www.inrim.it/res/tf/ora_legale_i.shtml +# (2016-10-24): +# http://www.renzobaldini.it/le-ore-legali-in-italia/ +# has still different data for 1944. It divides Italy in two, as +# there were effectively two governments at the time, north of Gothic +# Line German controlled territory, official government RSI, and south +# of the Gothic Line, controlled by allied armies. +# +# From Brian Inglis (2016-10-23): +# Viceregal LEGISLATIVE DECREE. 14 September 1944, no. 219. +# Restoration of Standard Time. (044U0219) (OJ 62 of 30.9.1944) ... +# Given the R. law decreed on 1944-03-29, no. 92, by which standard time is +# advanced to sixty minutes later starting at hour two on 1944-04-02; ... +# Starting at hour three on the date 1944-09-17 standard time will be resumed. +# +# From Paul Eggert (2016-10-27): +# Go with INRiM for DST rules, except as corrected by Inglis for 1944 +# for the Kingdom of Italy. This is consistent with Renzo Baldini. +# Model Rome's occupation by using using C-Eur rules from 1943-09-10 +# to 1944-06-04; although Rome was an open city during this period, it +# was effectively controlled by Germany. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Italy 1916 only - Jun 3 0:00s 1:00 S -Rule Italy 1916 only - Oct 1 0:00s 0 - -Rule Italy 1917 only - Apr 1 0:00s 1:00 S -Rule Italy 1917 only - Sep 30 0:00s 0 - -Rule Italy 1918 only - Mar 10 0:00s 1:00 S -Rule Italy 1918 1919 - Oct Sun>=1 0:00s 0 - -Rule Italy 1919 only - Mar 2 0:00s 1:00 S -Rule Italy 1920 only - Mar 21 0:00s 1:00 S -Rule Italy 1920 only - Sep 19 0:00s 0 - -Rule Italy 1940 only - Jun 15 0:00s 1:00 S -Rule Italy 1944 only - Sep 17 0:00s 0 - -Rule Italy 1945 only - Apr 2 2:00 1:00 S -Rule Italy 1945 only - Sep 15 0:00s 0 - -Rule Italy 1946 only - Mar 17 2:00s 1:00 S -Rule Italy 1946 only - Oct 6 2:00s 0 - -Rule Italy 1947 only - Mar 16 0:00s 1:00 S -Rule Italy 1947 only - Oct 5 0:00s 0 - -Rule Italy 1948 only - Feb 29 2:00s 1:00 S -Rule Italy 1948 only - Oct 3 2:00s 0 - -Rule Italy 1966 1968 - May Sun>=22 0:00 1:00 S -Rule Italy 1966 1969 - Sep Sun>=22 0:00 0 - -Rule Italy 1969 only - Jun 1 0:00 1:00 S -Rule Italy 1970 only - May 31 0:00 1:00 S -Rule Italy 1970 only - Sep lastSun 0:00 0 - -Rule Italy 1971 1972 - May Sun>=22 0:00 1:00 S -Rule Italy 1971 only - Sep lastSun 1:00 0 - -Rule Italy 1972 only - Oct 1 0:00 0 - -Rule Italy 1973 only - Jun 3 0:00 1:00 S -Rule Italy 1973 1974 - Sep lastSun 0:00 0 - -Rule Italy 1974 only - May 26 0:00 1:00 S -Rule Italy 1975 only - Jun 1 0:00s 1:00 S -Rule Italy 1975 1977 - Sep lastSun 0:00s 0 - -Rule Italy 1976 only - May 30 0:00s 1:00 S -Rule Italy 1977 1979 - May Sun>=22 0:00s 1:00 S -Rule Italy 1978 only - Oct 1 0:00s 0 - -Rule Italy 1979 only - Sep 30 0:00s 0 - +Rule Italy 1916 only - Jun 3 24:00 1:00 S +Rule Italy 1916 1917 - Sep 30 24:00 0 - +Rule Italy 1917 only - Mar 31 24:00 1:00 S +Rule Italy 1918 only - Mar 9 24:00 1:00 S +Rule Italy 1918 only - Oct 6 24:00 0 - +Rule Italy 1919 only - Mar 1 24:00 1:00 S +Rule Italy 1919 only - Oct 4 24:00 0 - +Rule Italy 1920 only - Mar 20 24:00 1:00 S +Rule Italy 1920 only - Sep 18 24:00 0 - +Rule Italy 1940 only - Jun 14 24:00 1:00 S +Rule Italy 1942 only - Nov 2 2:00s 0 - +Rule Italy 1943 only - Mar 29 2:00s 1:00 S +Rule Italy 1943 only - Oct 4 2:00s 0 - +Rule Italy 1944 only - Apr 2 2:00s 1:00 S +Rule Italy 1944 only - Sep 17 2:00s 0 - +Rule Italy 1945 only - Apr 2 2:00 1:00 S +Rule Italy 1945 only - Sep 15 1:00 0 - +Rule Italy 1946 only - Mar 17 2:00s 1:00 S +Rule Italy 1946 only - Oct 6 2:00s 0 - +Rule Italy 1947 only - Mar 16 0:00s 1:00 S +Rule Italy 1947 only - Oct 5 0:00s 0 - +Rule Italy 1948 only - Feb 29 2:00s 1:00 S +Rule Italy 1948 only - Oct 3 2:00s 0 - +Rule Italy 1966 1968 - May Sun>=22 0:00s 1:00 S +Rule Italy 1966 only - Sep 24 24:00 0 - +Rule Italy 1967 1969 - Sep Sun>=22 0:00s 0 - +Rule Italy 1969 only - Jun 1 0:00s 1:00 S +Rule Italy 1970 only - May 31 0:00s 1:00 S +Rule Italy 1970 only - Sep lastSun 0:00s 0 - +Rule Italy 1971 1972 - May Sun>=22 0:00s 1:00 S +Rule Italy 1971 only - Sep lastSun 0:00s 0 - +Rule Italy 1972 only - Oct 1 0:00s 0 - +Rule Italy 1973 only - Jun 3 0:00s 1:00 S +Rule Italy 1973 1974 - Sep lastSun 0:00s 0 - +Rule Italy 1974 only - May 26 0:00s 1:00 S +Rule Italy 1975 only - Jun 1 0:00s 1:00 S +Rule Italy 1975 1977 - Sep lastSun 0:00s 0 - +Rule Italy 1976 only - May 30 0:00s 1:00 S +Rule Italy 1977 1979 - May Sun>=22 0:00s 1:00 S +Rule Italy 1978 only - Oct 1 0:00s 0 - +Rule Italy 1979 only - Sep 30 0:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Rome 0:49:56 - LMT 1866 Sep 22 - 0:49:56 - RMT 1893 Nov 1 0:00s # Rome Mean - 1:00 Italy CE%sT 1942 Nov 2 2:00s - 1:00 C-Eur CE%sT 1944 Jul + 0:49:56 - RMT 1893 Oct 31 23:49:56 # Rome Mean + 1:00 Italy CE%sT 1943 Sep 10 + 1:00 C-Eur CE%sT 1944 Jun 4 1:00 Italy CE%sT 1980 1:00 EU CE%sT @@ -1788,6 +1799,10 @@ Zone Europe/Luxembourg 0:24:36 - LMT 1904 Jun # See Europe/Belgrade. # Malta +# +# From Paul Eggert (2016-10-21): +# Assume 1900-1972 was like Rome, overriding Shanks. +# # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Malta 1973 only - Mar 31 0:00s 1:00 S Rule Malta 1973 only - Sep 29 0:00s 0 - @@ -1798,8 +1813,6 @@ Rule Malta 1975 1980 - Sep Sun>=15 2:00 0 - Rule Malta 1980 only - Mar 31 2:00 1:00 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Malta 0:58:04 - LMT 1893 Nov 2 0:00s # Valletta - 1:00 Italy CE%sT 1942 Nov 2 2:00s - 1:00 C-Eur CE%sT 1945 Apr 2 2:00s 1:00 Italy CE%sT 1973 Mar 31 1:00 Malta CE%sT 1981 1:00 EU CE%sT @@ -1931,7 +1944,7 @@ Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15 # Amsterdam mean time. # The data entries before 1945 are taken from -# http://www.staff.science.uu.nl/~gent0113/idl/idl.htm +# http://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Neth 1916 only - May 1 0:00 1:00 NST # Netherlands Summer Time diff --git a/jdk/make/data/tzdata/zone.tab b/jdk/make/data/tzdata/zone.tab index db050608240..2de07ef7112 100644 --- a/jdk/make/data/tzdata/zone.tab +++ b/jdk/make/data/tzdata/zone.tab @@ -175,7 +175,8 @@ CU +2308-08222 America/Havana CV +1455-02331 Atlantic/Cape_Verde CW +1211-06900 America/Curacao CX -1025+10543 Indian/Christmas -CY +3510+03322 Asia/Nicosia +CY +3510+03322 Asia/Nicosia Cyprus (most areas) +CY +3507+03357 Asia/Famagusta Northern Cyprus CZ +5005+01426 Europe/Prague DE +5230+01322 Europe/Berlin Germany (most areas) DE +4742+00841 Europe/Busingen Busingen diff --git a/jdk/test/sun/util/calendar/zi/tzdata/VERSION b/jdk/test/sun/util/calendar/zi/tzdata/VERSION index 7009f248679..3fbffda8d33 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION +++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2016h +tzdata2016i diff --git a/jdk/test/sun/util/calendar/zi/tzdata/antarctica b/jdk/test/sun/util/calendar/zi/tzdata/antarctica index f96947abc7c..2398ac51b07 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/antarctica +++ b/jdk/test/sun/util/calendar/zi/tzdata/antarctica @@ -87,13 +87,18 @@ # Background: # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html +# From Steffen Thorsen (2016-10-28): +# Australian Antarctica Division informed us that Casey changed time +# zone to UTC+11 in "the morning of 22nd October 2016". + # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2009 Oct 18 2:00 11:00 - +11 2010 Mar 5 2:00 8:00 - +08 2011 Oct 28 2:00 11:00 - +11 2012 Feb 21 17:00u - 8:00 - +08 + 8:00 - +08 2016 Oct 22 + 11:00 - +11 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb diff --git a/jdk/test/sun/util/calendar/zi/tzdata/asia b/jdk/test/sun/util/calendar/zi/tzdata/asia index 71711a946d1..7d540324cdb 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/asia +++ b/jdk/test/sun/util/calendar/zi/tzdata/asia @@ -794,9 +794,19 @@ Zone Asia/Macau 7:34:20 - LMT 1912 Jan 1 ############################################################################### # Cyprus -# + # Milne says the Eastern Telegraph Company used 2:14:00. Stick with LMT. +# IATA SSIM (1998-09) has Cyprus using EU rules for the first time. + +# From Paul Eggert (2016-09-09): +# Yesterday's Cyprus Mail reports that Northern Cyprus followed Turkey's +# lead and switched from +02/+03 to +03 year-round. +# http://cyprus-mail.com/2016/09/08/two-time-zones-cyprus-turkey-will-not-turn-clocks-back-next-month/ # +# From Even Scharning (2016-10-31): +# Looks like the time zone split in Cyprus went through last night. +# http://cyprus-mail.com/2016/10/30/cyprus-new-division-two-time-zones-now-reality/ + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Cyprus 1975 only - Apr 13 0:00 1:00 S Rule Cyprus 1975 only - Oct 12 0:00 0 - @@ -811,7 +821,10 @@ Rule Cyprus 1981 1998 - Mar lastSun 0:00 1:00 S Zone Asia/Nicosia 2:13:28 - LMT 1921 Nov 14 2:00 Cyprus EE%sT 1998 Sep 2:00 EUAsia EE%sT -# IATA SSIM (1998-09) has Cyprus using EU rules for the first time. +Zone Asia/Famagusta 2:15:48 - LMT 1921 Nov 14 + 2:00 Cyprus EE%sT 1998 Sep + 2:00 EUAsia EE%sT 2016 Sep 8 + 3:00 - +03 # Classically, Cyprus belongs to Asia; e.g. see Herodotus, Histories, I.72. # However, for various reasons many users expect to find it under Europe. diff --git a/jdk/test/sun/util/calendar/zi/tzdata/australasia b/jdk/test/sun/util/calendar/zi/tzdata/australasia index 23153b171fa..81ef5215942 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/australasia +++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia @@ -725,11 +725,13 @@ Rule Tonga 1999 only - Oct 7 2:00s 1:00 S Rule Tonga 2000 only - Mar 19 2:00s 0 - Rule Tonga 2000 2001 - Nov Sun>=1 2:00 1:00 S Rule Tonga 2001 2002 - Jan lastSun 2:00 0 - +Rule Tonga 2016 max - Nov Sun>=1 2:00 1:00 S +Rule Tonga 2017 max - Jan Sun>=15 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Tongatapu 12:19:20 - LMT 1901 - 12:20 - TOT 1941 # Tonga Time - 13:00 - TOT 1999 - 13:00 Tonga TO%sT + 12:20 - +1220 1941 + 13:00 - +13 1999 + 13:00 Tonga +13/+14 # Tuvalu # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -1735,9 +1737,17 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # of January the standard time in the Kingdom shall be moved backward by one # hour to 1:00am. -# From Pulu 'Anau (2002-11-05): +# From Pulu ʻAnau (2002-11-05): # The law was for 3 years, supposedly to get renewed. It wasn't. +# From Pulu ʻAnau (2016-10-27): +# http://mic.gov.to/news-today/press-releases/6375-daylight-saving-set-to-run-from-6-november-2016-to-15-january-2017 +# Cannot find anyone who knows the rules, has seen the duration or has seen +# the cabinet decision, but it appears we are following Fiji's rule set. +# +# From Tim Parenti (2016-10-26): +# Assume Tonga will observe DST from the first Sunday in November at 02:00 +# through the third Sunday in January at 03:00, like Fiji, for now. # Wake diff --git a/jdk/test/sun/util/calendar/zi/tzdata/europe b/jdk/test/sun/util/calendar/zi/tzdata/europe index d182dbb6ba8..df464859fb3 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/europe +++ b/jdk/test/sun/util/calendar/zi/tzdata/europe @@ -1523,73 +1523,84 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # But these events all occurred before the 1970 cutoff, # so record only the time in Rome. # -# From Paul Eggert (2006-03-22): -# For Italian DST we have three sources: Shanks & Pottenger, Whitman, and -# F. Pollastri -# Day-light Saving Time in Italy (2006-02-03) -# http://toi.iriti.cnr.it/uk/ienitlt.html -# ('FP' below), taken from an Italian National Electrotechnical Institute -# publication. When the three sources disagree, guess who's right, as follows: +# From Michael Deckers (2016-10-24): +# http://www.ac-ilsestante.it/MERIDIANE/ora_legale quotes a law of 1893-08-10 +# ... [translated as] "The preceding dispositions will enter into +# force at the instant at which, according to the time specified in +# the 1st article, the 1st of November 1893 will begin...." # -# year FP Shanks&P. (S) Whitman (W) Go with: -# 1916 06-03 06-03 24:00 06-03 00:00 FP & W -# 09-30 09-30 24:00 09-30 01:00 FP; guess 24:00s -# 1917 04-01 03-31 24:00 03-31 00:00 FP & S -# 09-30 09-29 24:00 09-30 01:00 FP & W -# 1918 03-09 03-09 24:00 03-09 00:00 FP & S -# 10-06 10-05 24:00 10-06 01:00 FP & W -# 1919 03-01 03-01 24:00 03-01 00:00 FP & S -# 10-04 10-04 24:00 10-04 01:00 FP; guess 24:00s -# 1920 03-20 03-20 24:00 03-20 00:00 FP & S -# 09-18 09-18 24:00 10-01 01:00 FP; guess 24:00s -# 1944 04-02 04-03 02:00 S (see C-Eur) -# 09-16 10-02 03:00 FP; guess 24:00s -# 1945 09-14 09-16 24:00 FP; guess 24:00s -# 1970 05-21 05-31 00:00 S -# 09-20 09-27 00:00 S +# From Pierpaolo Bernardi (2016-10-20): +# The authoritative source for time in Italy is the national metrological +# institute, which has a summary page of historical DST data at +# http://www.inrim.it/res/tf/ora_legale_i.shtml +# (2016-10-24): +# http://www.renzobaldini.it/le-ore-legali-in-italia/ +# has still different data for 1944. It divides Italy in two, as +# there were effectively two governments at the time, north of Gothic +# Line German controlled territory, official government RSI, and south +# of the Gothic Line, controlled by allied armies. +# +# From Brian Inglis (2016-10-23): +# Viceregal LEGISLATIVE DECREE. 14 September 1944, no. 219. +# Restoration of Standard Time. (044U0219) (OJ 62 of 30.9.1944) ... +# Given the R. law decreed on 1944-03-29, no. 92, by which standard time is +# advanced to sixty minutes later starting at hour two on 1944-04-02; ... +# Starting at hour three on the date 1944-09-17 standard time will be resumed. +# +# From Paul Eggert (2016-10-27): +# Go with INRiM for DST rules, except as corrected by Inglis for 1944 +# for the Kingdom of Italy. This is consistent with Renzo Baldini. +# Model Rome's occupation by using using C-Eur rules from 1943-09-10 +# to 1944-06-04; although Rome was an open city during this period, it +# was effectively controlled by Germany. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Italy 1916 only - Jun 3 0:00s 1:00 S -Rule Italy 1916 only - Oct 1 0:00s 0 - -Rule Italy 1917 only - Apr 1 0:00s 1:00 S -Rule Italy 1917 only - Sep 30 0:00s 0 - -Rule Italy 1918 only - Mar 10 0:00s 1:00 S -Rule Italy 1918 1919 - Oct Sun>=1 0:00s 0 - -Rule Italy 1919 only - Mar 2 0:00s 1:00 S -Rule Italy 1920 only - Mar 21 0:00s 1:00 S -Rule Italy 1920 only - Sep 19 0:00s 0 - -Rule Italy 1940 only - Jun 15 0:00s 1:00 S -Rule Italy 1944 only - Sep 17 0:00s 0 - -Rule Italy 1945 only - Apr 2 2:00 1:00 S -Rule Italy 1945 only - Sep 15 0:00s 0 - -Rule Italy 1946 only - Mar 17 2:00s 1:00 S -Rule Italy 1946 only - Oct 6 2:00s 0 - -Rule Italy 1947 only - Mar 16 0:00s 1:00 S -Rule Italy 1947 only - Oct 5 0:00s 0 - -Rule Italy 1948 only - Feb 29 2:00s 1:00 S -Rule Italy 1948 only - Oct 3 2:00s 0 - -Rule Italy 1966 1968 - May Sun>=22 0:00 1:00 S -Rule Italy 1966 1969 - Sep Sun>=22 0:00 0 - -Rule Italy 1969 only - Jun 1 0:00 1:00 S -Rule Italy 1970 only - May 31 0:00 1:00 S -Rule Italy 1970 only - Sep lastSun 0:00 0 - -Rule Italy 1971 1972 - May Sun>=22 0:00 1:00 S -Rule Italy 1971 only - Sep lastSun 1:00 0 - -Rule Italy 1972 only - Oct 1 0:00 0 - -Rule Italy 1973 only - Jun 3 0:00 1:00 S -Rule Italy 1973 1974 - Sep lastSun 0:00 0 - -Rule Italy 1974 only - May 26 0:00 1:00 S -Rule Italy 1975 only - Jun 1 0:00s 1:00 S -Rule Italy 1975 1977 - Sep lastSun 0:00s 0 - -Rule Italy 1976 only - May 30 0:00s 1:00 S -Rule Italy 1977 1979 - May Sun>=22 0:00s 1:00 S -Rule Italy 1978 only - Oct 1 0:00s 0 - -Rule Italy 1979 only - Sep 30 0:00s 0 - +Rule Italy 1916 only - Jun 3 24:00 1:00 S +Rule Italy 1916 1917 - Sep 30 24:00 0 - +Rule Italy 1917 only - Mar 31 24:00 1:00 S +Rule Italy 1918 only - Mar 9 24:00 1:00 S +Rule Italy 1918 only - Oct 6 24:00 0 - +Rule Italy 1919 only - Mar 1 24:00 1:00 S +Rule Italy 1919 only - Oct 4 24:00 0 - +Rule Italy 1920 only - Mar 20 24:00 1:00 S +Rule Italy 1920 only - Sep 18 24:00 0 - +Rule Italy 1940 only - Jun 14 24:00 1:00 S +Rule Italy 1942 only - Nov 2 2:00s 0 - +Rule Italy 1943 only - Mar 29 2:00s 1:00 S +Rule Italy 1943 only - Oct 4 2:00s 0 - +Rule Italy 1944 only - Apr 2 2:00s 1:00 S +Rule Italy 1944 only - Sep 17 2:00s 0 - +Rule Italy 1945 only - Apr 2 2:00 1:00 S +Rule Italy 1945 only - Sep 15 1:00 0 - +Rule Italy 1946 only - Mar 17 2:00s 1:00 S +Rule Italy 1946 only - Oct 6 2:00s 0 - +Rule Italy 1947 only - Mar 16 0:00s 1:00 S +Rule Italy 1947 only - Oct 5 0:00s 0 - +Rule Italy 1948 only - Feb 29 2:00s 1:00 S +Rule Italy 1948 only - Oct 3 2:00s 0 - +Rule Italy 1966 1968 - May Sun>=22 0:00s 1:00 S +Rule Italy 1966 only - Sep 24 24:00 0 - +Rule Italy 1967 1969 - Sep Sun>=22 0:00s 0 - +Rule Italy 1969 only - Jun 1 0:00s 1:00 S +Rule Italy 1970 only - May 31 0:00s 1:00 S +Rule Italy 1970 only - Sep lastSun 0:00s 0 - +Rule Italy 1971 1972 - May Sun>=22 0:00s 1:00 S +Rule Italy 1971 only - Sep lastSun 0:00s 0 - +Rule Italy 1972 only - Oct 1 0:00s 0 - +Rule Italy 1973 only - Jun 3 0:00s 1:00 S +Rule Italy 1973 1974 - Sep lastSun 0:00s 0 - +Rule Italy 1974 only - May 26 0:00s 1:00 S +Rule Italy 1975 only - Jun 1 0:00s 1:00 S +Rule Italy 1975 1977 - Sep lastSun 0:00s 0 - +Rule Italy 1976 only - May 30 0:00s 1:00 S +Rule Italy 1977 1979 - May Sun>=22 0:00s 1:00 S +Rule Italy 1978 only - Oct 1 0:00s 0 - +Rule Italy 1979 only - Sep 30 0:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Rome 0:49:56 - LMT 1866 Sep 22 - 0:49:56 - RMT 1893 Nov 1 0:00s # Rome Mean - 1:00 Italy CE%sT 1942 Nov 2 2:00s - 1:00 C-Eur CE%sT 1944 Jul + 0:49:56 - RMT 1893 Oct 31 23:49:56 # Rome Mean + 1:00 Italy CE%sT 1943 Sep 10 + 1:00 C-Eur CE%sT 1944 Jun 4 1:00 Italy CE%sT 1980 1:00 EU CE%sT @@ -1788,6 +1799,10 @@ Zone Europe/Luxembourg 0:24:36 - LMT 1904 Jun # See Europe/Belgrade. # Malta +# +# From Paul Eggert (2016-10-21): +# Assume 1900-1972 was like Rome, overriding Shanks. +# # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Malta 1973 only - Mar 31 0:00s 1:00 S Rule Malta 1973 only - Sep 29 0:00s 0 - @@ -1798,8 +1813,6 @@ Rule Malta 1975 1980 - Sep Sun>=15 2:00 0 - Rule Malta 1980 only - Mar 31 2:00 1:00 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Malta 0:58:04 - LMT 1893 Nov 2 0:00s # Valletta - 1:00 Italy CE%sT 1942 Nov 2 2:00s - 1:00 C-Eur CE%sT 1945 Apr 2 2:00s 1:00 Italy CE%sT 1973 Mar 31 1:00 Malta CE%sT 1981 1:00 EU CE%sT @@ -1931,7 +1944,7 @@ Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15 # Amsterdam mean time. # The data entries before 1945 are taken from -# http://www.staff.science.uu.nl/~gent0113/idl/idl.htm +# http://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Neth 1916 only - May 1 0:00 1:00 NST # Netherlands Summer Time diff --git a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab index db050608240..2de07ef7112 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab +++ b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab @@ -175,7 +175,8 @@ CU +2308-08222 America/Havana CV +1455-02331 Atlantic/Cape_Verde CW +1211-06900 America/Curacao CX -1025+10543 Indian/Christmas -CY +3510+03322 Asia/Nicosia +CY +3510+03322 Asia/Nicosia Cyprus (most areas) +CY +3507+03357 Asia/Famagusta Northern Cyprus CZ +5005+01426 Europe/Prague DE +5230+01322 Europe/Berlin Germany (most areas) DE +4742+00841 Europe/Busingen Busingen From 9555cf3b507c630560b6d5fb11238c986eff0242 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Wed, 9 Nov 2016 10:36:32 -0800 Subject: [PATCH 11/54] 8164934: Optional.map() javadoc code example Reviewed-by: forax, chegar --- .../share/classes/java/util/Optional.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/Optional.java b/jdk/src/java.base/share/classes/java/util/Optional.java index 28700a836f2..94f3c17511a 100644 --- a/jdk/src/java.base/share/classes/java/util/Optional.java +++ b/jdk/src/java.base/share/classes/java/util/Optional.java @@ -214,20 +214,20 @@ public final class Optional { * @apiNote * This method supports post-processing on {@code Optional} values, without * the need to explicitly check for a return status. For example, the - * following code traverses a stream of file names, selects one that has not - * yet been processed, and then opens that file, returning an - * {@code Optional}: + * following code traverses a stream of URIs, selects one that has not + * yet been processed, and creates a path from that URI, returning + * an {@code Optional}: * *

{@code
-     *     Optional fis =
-     *         names.stream().filter(name -> !isProcessedYet(name))
+     *     Optional p =
+     *         uris.stream().filter(uri -> !isProcessedYet(uri))
      *                       .findFirst()
-     *                       .map(name -> new FileInputStream(name));
+     *                       .map(Paths::get);
      * }
* - * Here, {@code findFirst} returns an {@code Optional}, and then - * {@code map} returns an {@code Optional} for the desired - * file if one exists. + * Here, {@code findFirst} returns an {@code Optional}, and then + * {@code map} returns an {@code Optional} for the desired + * URI if one exists. * * @param mapper the mapping function to apply to a value, if present * @param The type of the value returned from the mapping function From 1c628411dff99daf8f11fd9480b9a1bc5ea1654a Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 10 Nov 2016 08:59:34 +0000 Subject: [PATCH 12/54] 8169362: Interop automated testing with Chrome Reviewed-by: wetmore, jnimeh, asmotrak --- .../ssl/interop/ClientHelloChromeInterOp.java | 75 +++ .../net/ssl/interop/ClientHelloInterOp.java | 432 ++++++++++++++++++ 2 files changed, 507 insertions(+) create mode 100644 jdk/test/javax/net/ssl/interop/ClientHelloChromeInterOp.java create mode 100644 jdk/test/javax/net/ssl/interop/ClientHelloInterOp.java diff --git a/jdk/test/javax/net/ssl/interop/ClientHelloChromeInterOp.java b/jdk/test/javax/net/ssl/interop/ClientHelloChromeInterOp.java new file mode 100644 index 00000000000..5921a971c77 --- /dev/null +++ b/jdk/test/javax/net/ssl/interop/ClientHelloChromeInterOp.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016, 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. + */ + +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + +/* + * @test + * @bug 8169362 + * @summary Interop automated testing with Chrome + * @modules java.base/sun.security.util + * @run main/othervm ClientHelloChromeInterOp + */ + +import java.util.Base64; +import sun.security.util.HexDumpEncoder; + +public class ClientHelloChromeInterOp extends ClientHelloInterOp { + // The ClientHello message. + // + // Captured from Chrome browser (version 54.0.2840.87 m (64-bit)) on + // Windows 10. + private final static String ClientHelloMsg = + "FgMBAL4BAAC6AwOWBEueOntnurZ+WAW0D9Qn2HpdzXLu0MgDjsD9e5JU6AAAIsA\n" + + "rwC/ALMAwzKnMqMwUzBPACcATwArAFACcAJ0ALwA1AAoBAABv/wEAAQAAAAATAB\n" + + "EAAA53d3cub3JhY2xlLmNvbQAXAAAAIwAAAA0AEgAQBgEGAwUBBQMEAQQDAgECA\n" + + "wAFAAUBAAAAAAASAAAAEAAOAAwCaDIIaHR0cC8xLjF1UAAAAAsAAgEAAAoACAAG\n" + + "AB0AFwAY"; + + /* + * Main entry point for this test. + */ + public static void main(String args[]) throws Exception { + (new ClientHelloChromeInterOp()).run(); + } + + @Override + protected byte[] createClientHelloMessage() { + byte[] bytes = Base64.getMimeDecoder().decode(ClientHelloMsg); + + // Dump the hex codes of the ClientHello message so that developers + // can easily check whether the message is captured correct or not. + HexDumpEncoder dump = new HexDumpEncoder(); + System.out.println("The ClientHello message used"); + try { + dump.encodeBuffer(bytes, System.out); + } catch (Exception e) { + // ignore + } + + return bytes; + } +} diff --git a/jdk/test/javax/net/ssl/interop/ClientHelloInterOp.java b/jdk/test/javax/net/ssl/interop/ClientHelloInterOp.java new file mode 100644 index 00000000000..c6bf74bd533 --- /dev/null +++ b/jdk/test/javax/net/ssl/interop/ClientHelloInterOp.java @@ -0,0 +1,432 @@ +/* + * Copyright (c) 2016, 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. + */ + +import javax.net.ssl.*; +import javax.net.ssl.SSLEngineResult.*; +import java.io.*; +import java.nio.*; +import java.security.KeyStore; +import java.security.PrivateKey; +import java.security.KeyFactory; +import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; +import java.security.spec.*; +import java.util.Base64; + +public abstract class ClientHelloInterOp { + + /* + * Certificates and keys used in the test. + */ + // Trusted certificates. + private final static String[] trustedCertStrs = { + // SHA256withECDSA, curve prime256v1 + // Validity + // Not Before: Nov 9 03:24:05 2016 GMT + // Not After : Oct 20 03:24:05 2037 GMT + "-----BEGIN CERTIFICATE-----\n" + + "MIICHDCCAcGgAwIBAgIJAM83C/MVp9F5MAoGCCqGSM49BAMCMDsxCzAJBgNVBAYT\n" + + "AlVTMQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + + "ZTAeFw0xNjExMDkwMzI0MDVaFw0zNzEwMjAwMzI0MDVaMDsxCzAJBgNVBAYTAlVT\n" + + "MQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2VyaXZjZTBZ\n" + + "MBMGByqGSM49AgEGCCqGSM49AwEHA0IABGeQXwyeNyU4UAATfwUbMO5zaREI21Wh\n" + + "bds6WDu+PmfK8SWsTgsgpYxBRui+fZtYqSmbdjkurvAQ3j2fvN++BtWjga0wgaow\n" + + "HQYDVR0OBBYEFDF/OeJ82qBSRkAm1rdZUPbWfDzyMGsGA1UdIwRkMGKAFDF/OeJ8\n" + + "2qBSRkAm1rdZUPbWfDzyoT+kPTA7MQswCQYDVQQGEwJVUzENMAsGA1UEChMESmF2\n" + + "YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2WCCQDPNwvzFafReTAPBgNV\n" + + "HRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBBjAKBggqhkjOPQQDAgNJADBGAiEAlHQY\n" + + "QFPlODOsjLVQYSxgeSUvYzMp0vP8naeVB9bfFG8CIQCFfrKZvhq9z3bOtlYKxs2a\n" + + "EWUjUZ82a1JTqkP+lgHY5A==\n" + + "-----END CERTIFICATE-----", + + // SHA256withRSA, 2048 bits + // Validity + // Not Before: Nov 9 03:24:16 2016 GMT + // Not After : Oct 20 03:24:16 2037 GMT + "-----BEGIN CERTIFICATE-----\n" + + "MIIDpzCCAo+gAwIBAgIJAJAYpR2aIlA1MA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNV\n" + + "BAYTAlVTMQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2Vy\n" + + "aXZjZTAeFw0xNjExMDkwMzI0MTZaFw0zNzEwMjAwMzI0MTZaMDsxCzAJBgNVBAYT\n" + + "AlVTMQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + + "ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL+F/FTPODYzsU0Pakfp\n" + + "lsh88YoQWZPjABhCU+HPsCTMYc8UBkaiduUzregwwVBW3D7kmec2K408krGQsxdy\n" + + "oKJA12GL/XX1YgzDEsyBRk/gvex5lPaBIZiJ5IZlUfjLuRDGxPjtRelBTpZ7SUet\n" + + "PJVZz6zV6hMPGO6kQzCtbzzET515EE0okIS40LkAmtWoOmVm3gRldomaZTrZ0V2L\n" + + "MMaJGzrXYqk0SX+PYul8v+2EEHeMuaXG/XpK5xsg9gZvzpKqFQcBOdENoJHB07go\n" + + "jCmRC328ALqr+bMyktKAuYfB+mhjmN2AU8TQx72WPpvNTXxFDYcwo+8254cCAVKB\n" + + "e98CAwEAAaOBrTCBqjAdBgNVHQ4EFgQUlJQlQTbi8YIyiNf+SqF7LtH+gicwawYD\n" + + "VR0jBGQwYoAUlJQlQTbi8YIyiNf+SqF7LtH+giehP6Q9MDsxCzAJBgNVBAYTAlVT\n" + + "MQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2VyaXZjZYIJ\n" + + "AJAYpR2aIlA1MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMA0GCSqGSIb3\n" + + "DQEBCwUAA4IBAQAI0lTY0YAKQ2VdoIQ6dnqolphLVWdNGiC9drHEYSn7+hmAD2r2\n" + + "v1U/9m752TkcT74a65xKbEVuVtleD/w6i+QjALW2PYt6ivjOnnY0a9Y9a9UCa00j\n" + + "C9415sCw84Tp9VoKtuYqzhN87bBUeABOw5dsW3z32C2N/YhprkqeF/vdx4JxulPr\n" + + "PKze5BREXnKLA1ISoDioCPphvNMKrSpkAofb1rTCwtgt5V/WFls283L52ORmpRGO\n" + + "Ja88ztXOz00ZGu0RQLwlmpN7m8tNgA/5MPrldyYIwegP4RSkkJlF/8+hxvvqfJhK\n" + + "FFDa0HHQSJfR2b9628Iniw1UHOMMT6qx5EHr\n" + + "-----END CERTIFICATE-----" + }; + + // End entity certificate. + private final static String[] endEntityCertStrs = { + // SHA256withECDSA, curve prime256v1 + // Validity + // Not Before: Nov 9 03:24:05 2016 GMT + // Not After : Jul 27 03:24:05 2036 GMT + "-----BEGIN CERTIFICATE-----\n" + + "MIIB1DCCAXmgAwIBAgIJAKVa+4dIUjaLMAoGCCqGSM49BAMCMDsxCzAJBgNVBAYT\n" + + "AlVTMQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + + "ZTAeFw0xNjExMDkwMzI0MDVaFw0zNjA3MjcwMzI0MDVaMFIxCzAJBgNVBAYTAlVT\n" + + "MQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZjZTEV\n" + + "MBMGA1UEAwwMSW50ZXJPcCBUZXN0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE\n" + + "h4vXNUJzULq4e7fAOvF0WiWU6cllOAMus1GqTFvcnRPOChl8suZsvksO0CpZqL3h\n" + + "jXmVX9dp1FV/rUBGLo1aG6NPME0wCwYDVR0PBAQDAgPoMB0GA1UdDgQWBBSO8V5+\n" + + "bj0ik0T9BtJc4jLJt7m6wjAfBgNVHSMEGDAWgBQxfznifNqgUkZAJta3WVD21nw8\n" + + "8jAKBggqhkjOPQQDAgNJADBGAiEAk7MF+L9bFRwUsbPsBCbCqH9DMdzBQR+kFDNf\n" + + "lfn8Rs4CIQD9qWvBXd+EJqwraxiX6cftaFchn+T2HpvMboy+irMFow==\n" + + "-----END CERTIFICATE-----", + + // SHA256withRSA, 2048 bits + // Validity + // Not Before: Nov 9 03:24:16 2016 GMT + // Not After : Jul 27 03:24:16 2036 GMT + "-----BEGIN CERTIFICATE-----\n" + + "MIIDczCCAlugAwIBAgIJAPhM2oUKx0aJMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNV\n" + + "BAYTAlVTMQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2Vy\n" + + "aXZjZTAeFw0xNjExMDkwMzI0MTZaFw0zNjA3MjcwMzI0MTZaMFIxCzAJBgNVBAYT\n" + + "AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + + "ZTEVMBMGA1UEAwwMSW50ZXJPcCBUZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A\n" + + "MIIBCgKCAQEA36tJaXfJ2B/AFvES+tnueyQPSNABVu9nfMdU+NEPamJ+FH7cEF8Z\n" + + "1Spr1vlQgNzCpDUVrfnmT75rCapgz5ldA9+y+3hdfUyHjZBzzfx+6GHXLB4u6eU2\n" + + "NATa7vqSLNbcLcfZ7/QmkFqg4JRJbX4F42kKkRJrWdKZ8UoCYC8WXWvDaZ3nUs05\n" + + "XHe+mBJ8qMNPTbYST1jpzXPyH5CljlFGYi2mKJDTImDhwht7mu2+zvwvbJ81Gj2X\n" + + "JUSTSf9fu0zxFcCk6RmJPw9nSVqePVlOwtNNBodfKN+k4yr+gOz1v8NmMtmEtklV\n" + + "Sulr/J4QxI+E2Zar/C+4XjxkvstIS+PNKQIDAQABo2MwYTALBgNVHQ8EBAMCA+gw\n" + + "HQYDVR0OBBYEFHt19CItAz0VOF0WKGWwaT4DtEsSMB8GA1UdIwQYMBaAFJSUJUE2\n" + + "4vGCMojX/kqhey7R/oInMBIGA1UdEQEB/wQIMAaHBH8AAAEwDQYJKoZIhvcNAQEL\n" + + "BQADggEBACKYZWvo9B9IEpCCdBba2sNo4X1NI/VEY3fyUx1lkw+Kna+1d2Ab+RCZ\n" + + "cf3Y85fcwv03hNE///wNBp+Nde4NQRDK/oiQARzWwWslfinm5d83eQwzC3cpSzt+\n" + + "7ts6M5UlOblGsLXZI7THWO1tkgoEra9p+zezxLMmf/2MpNyZMZlVoJPM2YGxU9cN\n" + + "ws0AyeY1gpBEdT21vjsBPdxxj6qklXVMnzS3zF8YwXyOndDYQWdjmFEknRK/qmQ2\n" + + "gkLHrzpSpyCziecna5mGuDRdCU2dpsWiq1npEPXTq+PQGwWYcoaFTtXF8DDqhfPC\n" + + "4Abe8gPm6MfzerdmS3RFTj9b/DIIENM=\n" + + "-----END CERTIFICATE-----" + }; + + // Private key in the format of PKCS#8. + private final static String[] endEntityPrivateKeys = { + // + // EC private key related to cert endEntityCertStrs[0]. + // + "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgA3pmS+OrIjGyUv2F\n" + + "K/PkyayJIePM2RTFYxNoQqmJGnihRANCAASHi9c1QnNQurh7t8A68XRaJZTpyWU4\n" + + "Ay6zUapMW9ydE84KGXyy5my+Sw7QKlmoveGNeZVf12nUVX+tQEYujVob", + + // + // RSA private key related to cert endEntityCertStrs[1]. + // + "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDfq0lpd8nYH8AW\n" + + "8RL62e57JA9I0AFW72d8x1T40Q9qYn4UftwQXxnVKmvW+VCA3MKkNRWt+eZPvmsJ\n" + + "qmDPmV0D37L7eF19TIeNkHPN/H7oYdcsHi7p5TY0BNru+pIs1twtx9nv9CaQWqDg\n" + + "lEltfgXjaQqREmtZ0pnxSgJgLxZda8NpnedSzTlcd76YEnyow09NthJPWOnNc/If\n" + + "kKWOUUZiLaYokNMiYOHCG3ua7b7O/C9snzUaPZclRJNJ/1+7TPEVwKTpGYk/D2dJ\n" + + "Wp49WU7C000Gh18o36TjKv6A7PW/w2Yy2YS2SVVK6Wv8nhDEj4TZlqv8L7hePGS+\n" + + "y0hL480pAgMBAAECggEBAJyP1zk+IkloIBtu7+wrdCU6HoDHKMjjlzrehHoOTI4Z\n" + + "F0vdaMkE6J4vrYCyz0kEPjKW/e/jxvT2wxHm8xEdtuApS61+mWJFmXTcMlNzdJnR\n" + + "Mr6s+gW67fAHngA94OgGFeTtyX2PFxdgeM/6vFMqLZD7S+w0SnR7WEpvla4iB7On\n" + + "lXqhJKVQeVc+IpByg/S4MmJb91jck73GltCaCL/b6BTrsz+zc/AY5tb8JInxjMZ9\n" + + "jmjmA+s6l7tnBrFQfJHlF9a374lxCOtZTxyxVJjD7tQcGpsUpSHXZGdpDcT34qYT\n" + + "UGh0yp2Mc/1PfWni5gS/6UGLrYmT57RRCn5YJBJTEkkCgYEA/XPCNehFaOMSxOZh\n" + + "OGBVhQ+eRAmdpJfMhSUsDdEdQLZyWGmZsMTHjZZrwevBX/D0dxQYDv/sAl0GZomJ\n" + + "d6iRCHlscycwx5Q0U/EpacsgRlYHz1nMRzXqS3Ry+8O8qQlliqCLUM7SfVgzdI5/\n" + + "ll9JMrng9NnRl8ccjEdOGK8g/MMCgYEA4eriKMfRslGY4uOQoTPbuEJSMMwQ2X4k\n" + + "lPj1p+xSQfU9QBaWJake67oBj3vpCxqN7/VkvCIeC6LCjhLpWHCn4EkdGiqkEdWz\n" + + "m5CHzpzVIgznzWnbt0rCVL2KdL+ihgY8KPDdsZ6tZrABHuYhsWkAu10wyvuQYM88\n" + + "3u6yOIQn36MCgYEAk5qR1UEzAxWTPbaJkgKQa5Cf9DHBbDS3eCcg098f8SsPxquh\n" + + "RRAkwzGCCgqZsJ0sUhkStdGXifzRGHAq7dPuuwe0ABAn2WNXYjeFjcYtQqkhnUFH\n" + + "tYURsOXdfQAOZEdDqos691GrxjHSraO7bECL6Y3VE+Oyq3jbCFsSgU+kn28CgYBT\n" + + "mrXZO6FJqVK33FlAns1YEgsSjeJKapklHEDkxNroF9Zz6ifkhgKwX6SGMefbORd/\n" + + "zsNZsBKIYdI3+52pIf+uS8BeV5tiEkCmeEUZ3AYv1LDP3rX1zc++xmn/rI97o8EN\n" + + "sZ2JRtyK3OV9RtL/MYmYzPLqm1Ah02+GXLVNnvKWmwKBgE8Ble8CzrXYuuPdGxXz\n" + + "BZU6HnXQrmTUcgeze0tj8SDHzCfsGsaG6pHrVNkT7CKsRuCHTZLM0kXmUijLFKuP\n" + + "5xyE257z4IbbEbs+tcbB3p28n4/47MzZkSR3kt8+FrsEMZq5oOHbFTGzgp9dhZCC\n" + + "dKUqlw5BPHdbxoWB/JpSHGCV" + }; + + // Private key names of endEntityPrivateKeys. + private final static String[] endEntityPrivateKeyNames = { + "EC", + "RSA" + }; + + /* + * Run the test case. + */ + public void run() throws Exception { + SSLEngine serverEngine = createServerEngine(); + + // + // Create and size the buffers appropriately. + // + SSLSession session = serverEngine.getSession(); + ByteBuffer serverAppInbound = + ByteBuffer.allocate(session.getApplicationBufferSize()); + ByteBuffer clientHello = + ByteBuffer.allocate(session.getPacketBufferSize()); + + // + // Generate a ClientHello message, and check if the server + // engine can read it or not. + // + clientHello.put(createClientHelloMessage()); + clientHello.flip(); + + SSLEngineResult serverResult = + serverEngine.unwrap(clientHello, serverAppInbound); + log("Server unwrap: ", serverResult); + runDelegatedTasks(serverResult, serverEngine); + + // + // Generate server responses to the ClientHello request. + // + ByteBuffer clientNetInbound = + ByteBuffer.allocate(session.getPacketBufferSize()); + ByteBuffer clientAppInbound = + ByteBuffer.wrap("Hello Client, I'm Server".getBytes()); + + serverResult = serverEngine.wrap(clientAppInbound, clientNetInbound); + log("Server wrap: ", serverResult); + runDelegatedTasks(serverResult, serverEngine); + } + + /* + * Create a ClientHello message. + */ + abstract protected byte[] createClientHelloMessage(); + + /* + * Create an instance of SSLContext for client use. + */ + protected SSLContext createClientSSLContext() throws Exception { + return createSSLContext(trustedCertStrs, null, null, null); + } + + /* + * Create an instance of SSLContext for server use. + */ + protected SSLContext createServerSSLContext() throws Exception { + return createSSLContext(null, + endEntityCertStrs, endEntityPrivateKeys, + endEntityPrivateKeyNames); + } + + /* + * Create an instance of SSLContext with the specified trust/key materials. + */ + protected SSLContext createSSLContext( + String[] trustedMaterials, + String[] keyMaterialCerts, + String[] keyMaterialKeys, + String[] keyMaterialKeyAlgs) throws Exception { + + KeyStore ts = null; // trust store + KeyStore ks = null; // key store + char passphrase[] = "passphrase".toCharArray(); + + // Generate certificate from cert string. + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + + // Import the trused certs. + ByteArrayInputStream is; + if (trustedMaterials != null && trustedMaterials.length != 0) { + ts = KeyStore.getInstance("JKS"); + ts.load(null, null); + + Certificate[] trustedCert = + new Certificate[trustedMaterials.length]; + for (int i = 0; i < trustedMaterials.length; i++) { + String trustedCertStr = trustedMaterials[i]; + + is = new ByteArrayInputStream(trustedCertStr.getBytes()); + try { + trustedCert[i] = cf.generateCertificate(is); + } finally { + is.close(); + } + + ts.setCertificateEntry("trusted-cert-" + i, trustedCert[i]); + } + } + + // Import the key materials. + // + // Note that certification pathes bigger than one are not supported yet. + boolean hasKeyMaterials = + (keyMaterialCerts != null) && (keyMaterialCerts.length != 0) && + (keyMaterialKeys != null) && (keyMaterialKeys.length != 0) && + (keyMaterialKeyAlgs != null) && (keyMaterialKeyAlgs.length != 0) && + (keyMaterialCerts.length == keyMaterialKeys.length) && + (keyMaterialCerts.length == keyMaterialKeyAlgs.length); + if (hasKeyMaterials) { + ks = KeyStore.getInstance("JKS"); + ks.load(null, null); + + for (int i = 0; i < keyMaterialCerts.length; i++) { + String keyCertStr = keyMaterialCerts[i]; + + // generate the private key. + PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec( + Base64.getMimeDecoder().decode(keyMaterialKeys[i])); + KeyFactory kf = + KeyFactory.getInstance(keyMaterialKeyAlgs[i]); + PrivateKey priKey = kf.generatePrivate(priKeySpec); + + // generate certificate chain + is = new ByteArrayInputStream(keyCertStr.getBytes()); + Certificate keyCert = null; + try { + keyCert = cf.generateCertificate(is); + } finally { + is.close(); + } + + Certificate[] chain = new Certificate[] { keyCert }; + + // import the key entry. + ks.setKeyEntry("cert-" + i, priKey, passphrase, chain); + } + } + + // Create an SSLContext object. + TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); + tmf.init(ts); + + SSLContext context = SSLContext.getInstance("TLS"); + if (hasKeyMaterials && ks != null) { + KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509"); + kmf.init(ks, passphrase); + + context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + } else { + context.init(null, tmf.getTrustManagers(), null); + } + + return context; + } + + /* + * Create an instance of SSLEngine in client mode. + */ + protected SSLEngine createClientEngine() throws Exception { + return createClientEngine(createClientSSLContext()); + } + + /* + * Create an instance of SSLEngine in client mode with the + * specified SSLContext object. + */ + protected SSLEngine createClientEngine( + SSLContext context) throws Exception { + + SSLEngine engine = context.createSSLEngine(); + engine.setUseClientMode(true); + + /* + * Customize the SSLEngine object. + */ + // blank + + return engine; + } + + /* + * Create an instance of SSLEngine in server mode. + */ + protected SSLEngine createServerEngine() throws Exception { + return createServerEngine(createServerSSLContext()); + } + + /* + * Create an instance of SSLEngine in server mode with the + * specified SSLContext object. + */ + protected SSLEngine createServerEngine( + SSLContext context) throws Exception { + + SSLEngine engine = context.createSSLEngine(); + engine.setUseClientMode(false); + + /* + * Customize the SSLEngine object. + */ + engine.setNeedClientAuth(false); + + return engine; + } + + /* + * Run the delagayed tasks if any. + * + * If the result indicates that we have outstanding tasks to do, + * go ahead and run them in this thread. + */ + protected static void runDelegatedTasks(SSLEngineResult result, + SSLEngine engine) throws Exception { + + if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { + Runnable runnable; + while ((runnable = engine.getDelegatedTask()) != null) { + log("\trunning delegated task..."); + runnable.run(); + } + HandshakeStatus hsStatus = engine.getHandshakeStatus(); + if (hsStatus == HandshakeStatus.NEED_TASK) { + throw new Exception( + "handshake shouldn't need additional tasks"); + } + log("\tnew HandshakeStatus: " + hsStatus); + } + } + + /* + * Logging the specificated message and the SSLEngine operation result. + */ + protected static void log(String str, SSLEngineResult result) { + HandshakeStatus hsStatus = result.getHandshakeStatus(); + log(str + + result.getStatus() + "/" + hsStatus + ", consumed: " + + result.bytesConsumed() + "/produced: " + result.bytesProduced() + + " bytes"); + + if (hsStatus == HandshakeStatus.FINISHED) { + log("\t...ready for application data"); + } + } + + /* + * Logging the specificated message. + */ + protected static void log(String str) { + System.out.println(str); + } +} From ac33542985a7430a467f7d0433946c5e1d4a08d7 Mon Sep 17 00:00:00 2001 From: Sergei Kovalev Date: Wed, 9 Nov 2016 14:24:41 +0300 Subject: [PATCH 13/54] 8169196: [TESTBUG] Three tests from sun/net/www have undeclared dependencies Reviewed-by: dfuchs --- .../net/www/http/HttpClient/RetryPost.java | 25 +++++-- .../sun/net/www/http/HttpClient/RetryPost.sh | 68 ------------------- .../http/KeepAliveStream/InfiniteLoop.java | 11 ++- .../sun/net/www/protocol/http/NoNTLM.java | 25 +++++-- 4 files changed, 46 insertions(+), 83 deletions(-) delete mode 100644 jdk/test/sun/net/www/http/HttpClient/RetryPost.sh diff --git a/jdk/test/sun/net/www/http/HttpClient/RetryPost.java b/jdk/test/sun/net/www/http/HttpClient/RetryPost.java index da7d868c3f2..1f2774d5a60 100644 --- a/jdk/test/sun/net/www/http/HttpClient/RetryPost.java +++ b/jdk/test/sun/net/www/http/HttpClient/RetryPost.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2016, 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 @@ -21,10 +21,25 @@ * questions. */ -import java.net.*; -import java.util.*; -import java.io.*; -import com.sun.net.httpserver.*; +/* + * @test + * @bug 6427251 6382788 + * @modules jdk.httpserver + * @run main RetryPost + * @run main/othervm -Dsun.net.http.retryPost=false RetryPost noRetry + * @summary HttpURLConnection automatically retries non-idempotent method POST + */ + +import com.sun.net.httpserver.HttpContext; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import java.io.IOException; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.SocketException; +import java.net.URL; import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; diff --git a/jdk/test/sun/net/www/http/HttpClient/RetryPost.sh b/jdk/test/sun/net/www/http/HttpClient/RetryPost.sh deleted file mode 100644 index 218c1d4b717..00000000000 --- a/jdk/test/sun/net/www/http/HttpClient/RetryPost.sh +++ /dev/null @@ -1,68 +0,0 @@ -# -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - - # @test - # @bug 6427251 6382788 - # @run shell/timeout=140 RetryPost.sh - # @summary HttpURLConnection automatically retries non-idempotent method POST - -OS=`uname -s` -case "$OS" in - SunOS | Linux | Darwin | AIX ) - PS=":" - FS="/" - ;; - CYGWIN* ) - PS=";" - FS="/" - ;; - Windows* ) - PS=";" - FS="\\" - ;; - * ) - echo "Unrecognized system!" - exit 1; - ;; -esac - -# compile -${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}${FS}RetryPost.java - -# run with no option specified. Should retry POST request. -${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} RetryPost -result=$? -if [ "$result" -ne "0" ]; then - exit 1 -fi - -# run with option specified. Should not retry POST request. -${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dsun.net.http.retryPost=false RetryPost noRetry -result=$? -if [ "$result" -ne "0" ]; then - exit 1 -fi - -# no failures, exit. -exit 0 - diff --git a/jdk/test/sun/net/www/http/KeepAliveStream/InfiniteLoop.java b/jdk/test/sun/net/www/http/KeepAliveStream/InfiniteLoop.java index c25c7fe2723..b3f0ced39dc 100644 --- a/jdk/test/sun/net/www/http/KeepAliveStream/InfiniteLoop.java +++ b/jdk/test/sun/net/www/http/KeepAliveStream/InfiniteLoop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -24,14 +24,19 @@ /* * @test * @bug 8004863 + * @modules jdk.httpserver * @summary Checks for proper close code in KeepAliveStream */ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; -import java.io.*; -import java.net.*; +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.URL; import java.util.concurrent.Phaser; // Racey test, will not always fail, but if it does then we have a problem. diff --git a/jdk/test/sun/net/www/protocol/http/NoNTLM.java b/jdk/test/sun/net/www/protocol/http/NoNTLM.java index 788bb3d3de8..a0b74a36b30 100644 --- a/jdk/test/sun/net/www/protocol/http/NoNTLM.java +++ b/jdk/test/sun/net/www/protocol/http/NoNTLM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -26,11 +26,19 @@ * @summary Sanity check that NTLM will not be selected by the http protocol * handler when running on a profile that does not support NTLM * @modules java.base/sun.net.www + * java.base/sun.net.www.protocol.http * @run main/othervm NoNTLM */ -import java.net.*; -import java.io.*; +import java.io.IOException; +import java.lang.reflect.Field; +import java.net.Authenticator; +import java.net.HttpURLConnection; +import java.net.PasswordAuthentication; +import java.net.Proxy; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; import sun.net.www.MessageHeader; public class NoNTLM { @@ -208,11 +216,14 @@ public class NoNTLM { } public static void main(String[] args) throws Exception { - // assume NTLM is not supported when Kerberos is not available try { - Class.forName("javax.security.auth.kerberos.KerberosPrincipal"); - System.out.println("Kerberos is present, assuming NTLM is supported too"); - return; + Class ntlmProxyClass = Class.forName("sun.net.www.protocol.http.NTLMAuthenticationProxy", true, NoNTLM.class.getClassLoader()); + Field ntlmSupportedField = ntlmProxyClass.getDeclaredField("supported"); + ntlmSupportedField.setAccessible(true); + if (ntlmSupportedField.getBoolean(null)) { + System.out.println("NTLM is supported. Nothing to do. Exiting."); + return; + } } catch (ClassNotFoundException okay) { } // setup Authenticator From e3e8bf9ebe3a124d86be3706a341a9e310964f99 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Thu, 10 Nov 2016 15:19:47 -0800 Subject: [PATCH 14/54] 8169001: Remove launcher's built-in ergonomics Reviewed-by: dholmes, erikj --- jdk/make/launcher/Launcher-jdk.compiler.gmk | 9 +- jdk/make/launcher/Launcher-jdk.javadoc.gmk | 3 +- jdk/make/launcher/Launcher-jdk.jdeps.gmk | 9 +- jdk/make/launcher/Launcher-jdk.jlink.gmk | 6 +- jdk/make/launcher/Launcher-jdk.jshell.gmk | 3 +- jdk/src/java.base/macosx/conf/x86_64/jvm.cfg | 2 +- .../macosx/native/libjli/java_md_macosx.c | 7 +- .../classes/sun/launcher/LauncherHelper.java | 27 +- .../launcher/resources/launcher.properties | 3 - .../java.base/share/native/launcher/defines.h | 10 +- .../java.base/share/native/launcher/main.c | 4 +- jdk/src/java.base/share/native/libjli/java.c | 79 +---- jdk/src/java.base/share/native/libjli/java.h | 9 - jdk/src/java.base/unix/conf/aarch64/jvm.cfg | 3 +- jdk/src/java.base/unix/conf/amd64/jvm.cfg | 3 +- jdk/src/java.base/unix/conf/i586/jvm.cfg | 4 +- jdk/src/java.base/unix/conf/ia64/jvm.cfg | 7 +- jdk/src/java.base/unix/conf/ppc64/jvm.cfg | 2 +- jdk/src/java.base/unix/conf/ppc64le/jvm.cfg | 2 +- jdk/src/java.base/unix/conf/s390x/jvm.cfg | 2 +- jdk/src/java.base/unix/conf/sparc/jvm.cfg | 6 +- jdk/src/java.base/unix/conf/sparcv9/jvm.cfg | 2 +- jdk/src/java.base/unix/conf/zero/jvm.cfg | 3 +- jdk/src/java.base/unix/native/libjli/ergo.c | 113 ------ jdk/src/java.base/unix/native/libjli/ergo.h | 42 --- .../java.base/unix/native/libjli/ergo_i586.c | 323 ------------------ jdk/src/java.base/windows/conf/amd64/jvm.cfg | 5 +- jdk/src/java.base/windows/conf/i586/jvm.cfg | 2 +- jdk/src/java.base/windows/conf/ia64/jvm.cfg | 6 +- .../java.base/windows/native/libjli/java_md.c | 5 - 30 files changed, 43 insertions(+), 658 deletions(-) delete mode 100644 jdk/src/java.base/unix/native/libjli/ergo.c delete mode 100644 jdk/src/java.base/unix/native/libjli/ergo.h delete mode 100644 jdk/src/java.base/unix/native/libjli/ergo_i586.c diff --git a/jdk/make/launcher/Launcher-jdk.compiler.gmk b/jdk/make/launcher/Launcher-jdk.compiler.gmk index 5a1637d1dc0..bf41ea83391 100644 --- a/jdk/make/launcher/Launcher-jdk.compiler.gmk +++ b/jdk/make/launcher/Launcher-jdk.compiler.gmk @@ -28,14 +28,12 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, javac, \ MAIN_CLASS := com.sun.tools.javac.Main, \ JAVA_ARGS := --add-modules ALL-DEFAULT, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ )) $(eval $(call SetupBuildLauncher, javah, \ MAIN_CLASS := com.sun.tools.javah.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ )) $(eval $(call SetupBuildLauncher, serialver, \ @@ -48,8 +46,7 @@ ifeq ($(ENABLE_SJAVAC), yes) # into any real images $(eval $(call SetupBuildLauncher, sjavac, \ MAIN_CLASS := com.sun.tools.sjavac.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ OUTPUT_DIR := $(JDK_OUTPUTDIR)/bin, \ )) endif diff --git a/jdk/make/launcher/Launcher-jdk.javadoc.gmk b/jdk/make/launcher/Launcher-jdk.javadoc.gmk index 534a9d97341..889028a2b17 100644 --- a/jdk/make/launcher/Launcher-jdk.javadoc.gmk +++ b/jdk/make/launcher/Launcher-jdk.javadoc.gmk @@ -28,6 +28,5 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, javadoc, \ MAIN_CLASS := jdk.javadoc.internal.tool.Main, \ JAVA_ARGS := --add-modules ALL-DEFAULT, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ )) diff --git a/jdk/make/launcher/Launcher-jdk.jdeps.gmk b/jdk/make/launcher/Launcher-jdk.jdeps.gmk index db29ecd88da..217523c48cc 100644 --- a/jdk/make/launcher/Launcher-jdk.jdeps.gmk +++ b/jdk/make/launcher/Launcher-jdk.jdeps.gmk @@ -27,18 +27,15 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, javap, \ MAIN_CLASS := com.sun.tools.javap.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ )) $(eval $(call SetupBuildLauncher, jdeps, \ MAIN_CLASS := com.sun.tools.jdeps.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ )) $(eval $(call SetupBuildLauncher, jdeprscan, \ MAIN_CLASS := com.sun.tools.jdeprscan.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ )) diff --git a/jdk/make/launcher/Launcher-jdk.jlink.gmk b/jdk/make/launcher/Launcher-jdk.jlink.gmk index 92cb61e5572..df2173996d7 100644 --- a/jdk/make/launcher/Launcher-jdk.jlink.gmk +++ b/jdk/make/launcher/Launcher-jdk.jlink.gmk @@ -34,13 +34,11 @@ $(eval $(call SetupBuildLauncher, jlink,\ MAIN_CLASS := jdk.tools.jlink.internal.Main, \ JAVA_ARGS := --add-modules ALL-DEFAULT, \ CFLAGS := -DENABLE_ARG_FILES \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + -DEXPAND_CLASSPATH_WILDCARDS, \ )) $(eval $(call SetupBuildLauncher, jmod,\ MAIN_CLASS := jdk.tools.jmod.Main, \ CFLAGS := -DENABLE_ARG_FILES \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + -DEXPAND_CLASSPATH_WILDCARDS, \ )) diff --git a/jdk/make/launcher/Launcher-jdk.jshell.gmk b/jdk/make/launcher/Launcher-jdk.jshell.gmk index b03f044c9c3..e80876f645c 100644 --- a/jdk/make/launcher/Launcher-jdk.jshell.gmk +++ b/jdk/make/launcher/Launcher-jdk.jshell.gmk @@ -27,6 +27,5 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, jshell, \ MAIN_CLASS := jdk.internal.jshell.tool.JShellTool, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ )) diff --git a/jdk/src/java.base/macosx/conf/x86_64/jvm.cfg b/jdk/src/java.base/macosx/conf/x86_64/jvm.cfg index 2502d2bacc3..d5acf55cf02 100644 --- a/jdk/src/java.base/macosx/conf/x86_64/jvm.cfg +++ b/jdk/src/java.base/macosx/conf/x86_64/jvm.cfg @@ -23,7 +23,7 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c index 8205f12f5d4..c6c36594a9d 100644 --- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c +++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -922,11 +922,6 @@ void SetJavaLauncherPlatformProps() { /* Linux only */ } -jboolean -ServerClassMachine(void) { - return JNI_TRUE; -} - static JavaVM* jvmInstance = NULL; static jboolean sameThread = JNI_FALSE; /* start VM in current thread */ diff --git a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java index f19ed371e52..45e781b9b4a 100644 --- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java +++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -139,8 +139,7 @@ public final class LauncherHelper { * line entirely. */ static void showSettings(boolean printToStderr, String optionFlag, - long initialHeapSize, long maxHeapSize, long stackSize, - boolean isServer) { + long initialHeapSize, long maxHeapSize, long stackSize) { initOutput(printToStderr); String opts[] = optionFlag.split(":"); @@ -149,8 +148,7 @@ public final class LauncherHelper { : "all"; switch (optStr) { case "vm": - printVmSettings(initialHeapSize, maxHeapSize, - stackSize, isServer); + printVmSettings(initialHeapSize, maxHeapSize, stackSize); break; case "properties": printProperties(); @@ -159,8 +157,7 @@ public final class LauncherHelper { printLocale(); break; default: - printVmSettings(initialHeapSize, maxHeapSize, stackSize, - isServer); + printVmSettings(initialHeapSize, maxHeapSize, stackSize); printProperties(); printLocale(); break; @@ -172,7 +169,7 @@ public final class LauncherHelper { */ private static void printVmSettings( long initialHeapSize, long maxHeapSize, - long stackSize, boolean isServer) { + long stackSize) { ostream.println(VM_SETTINGS); if (stackSize != 0L) { @@ -190,8 +187,6 @@ public final class LauncherHelper { ostream.println(INDENT + "Max. Heap Size (Estimated): " + SizePrefix.scaleValue(Runtime.getRuntime().maxMemory())); } - ostream.println(INDENT + "Ergonomics Machine Class: " - + ((isServer) ? "server" : "client")); ostream.println(INDENT + "Using VM: " + System.getProperty("java.vm.name")); ostream.println(); @@ -378,18 +373,6 @@ public final class LauncherHelper { vm1, vm2)); } - /** - * Appends the vm Ergo message to the header, already created. - * initHelpSystem must be called before using this method. - */ - static void appendVmErgoMessage(boolean isServerClass, String vm) { - outBuf = outBuf.append(getLocalizedMessage("java.launcher.ergo.message1", - vm)); - outBuf = (isServerClass) ? outBuf.append(",\n") - .append(getLocalizedMessage("java.launcher.ergo.message2")) - .append("\n\n") : outBuf.append(".\n\n"); - } - /** * Appends the last invariant part to the previously created messages, * and finishes up the printing to the desired output stream. diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties index 3801d542fcc..f66bfa92461 100644 --- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties +++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties @@ -35,9 +35,6 @@ java.launcher.opt.datamodel =\ -d{0}\t Deprecated, will be removed in a fut java.launcher.opt.vmselect =\ {0}\t to select the "{1}" VM\n java.launcher.opt.hotspot =\ {0}\t is a synonym for the "{1}" VM [deprecated]\n -java.launcher.ergo.message1 =\ The default VM is {0} -java.launcher.ergo.message2 =\ because you are running on a server-class machine.\n - # Translators please note do not translate the options themselves java.launcher.opt.footer =\ -cp \n\ \ -classpath \n\ diff --git a/jdk/src/java.base/share/native/launcher/defines.h b/jdk/src/java.base/share/native/launcher/defines.h index 1dd0cbe5b32..4470ae5d466 100644 --- a/jdk/src/java.base/share/native/launcher/defines.h +++ b/jdk/src/java.base/share/native/launcher/defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, 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 @@ -70,14 +70,6 @@ static const jboolean const_cpwildcard = JNI_TRUE; static const jboolean const_cpwildcard = JNI_FALSE; #endif /* EXPAND_CLASSPATH_WILDCARDS */ -#if defined(NEVER_ACT_AS_SERVER_CLASS_MACHINE) -static const jint const_ergo_class = NEVER_SERVER_CLASS; -#elif defined(ALWAYS_ACT_AS_SERVER_CLASS_MACHINE) -static const jint const_ergo_class = ALWAYS_SERVER_CLASS; -#else -static const jint const_ergo_class = DEFAULT_POLICY; -#endif /* NEVER_ACT_AS_SERVER_CLASS_MACHINE */ - #ifdef ENABLE_ARG_FILES static const jboolean const_disable_argfile = JNI_FALSE; #else diff --git a/jdk/src/java.base/share/native/launcher/main.c b/jdk/src/java.base/share/native/launcher/main.c index 22298385114..a254a154426 100644 --- a/jdk/src/java.base/share/native/launcher/main.c +++ b/jdk/src/java.base/share/native/launcher/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2016, 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 @@ -156,5 +156,5 @@ main(int argc, char **argv) (const_progname != NULL) ? const_progname : *margv, (const_launcher != NULL) ? const_launcher : *margv, HAS_JAVA_ARGS, - const_cpwildcard, const_javaw, const_ergo_class); + const_cpwildcard, const_javaw, 0); } diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c index 70a7bf7a6d9..914dbb4a7b7 100644 --- a/jdk/src/java.base/share/native/libjli/java.c +++ b/jdk/src/java.base/share/native/libjli/java.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2016, 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 @@ -78,7 +78,6 @@ static jboolean _is_java_args = JNI_FALSE; static jboolean _have_classpath = JNI_FALSE; static const char *_fVersion; static jboolean _wc_enabled = JNI_FALSE; -static jint _ergo_policy = DEFAULT_POLICY; /* * Entries for splash screen environment variables. @@ -218,7 +217,7 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */ jboolean javaargs, /* JAVA_ARGS */ jboolean cpwildcard, /* classpath wildcard*/ jboolean javaw, /* windows-only javaw */ - jint ergo /* ergonomics class policy */ + jint ergo /* unused */ ) { int mode = LM_UNKNOWN; @@ -236,7 +235,6 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */ _program_name = pname; _is_java_args = javaargs; _wc_enabled = cpwildcard; - _ergo_policy = ergo; InitLauncher(javaw); DumpState(); @@ -431,7 +429,7 @@ JavaMain(void * _args) LEAVE(); } - FreeKnownVMs(); /* after last possible PrintUsage() */ + FreeKnownVMs(); /* after last possible PrintUsage */ if (JLI_IsTraceLauncher()) { end = CounterGet(); @@ -669,11 +667,6 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) { /* use the default VM type if not specified (no alias processing) */ if (jvmtype == NULL) { char* result = knownVMs[0].name+1; - /* Use a different VM type if we are on a server class machine? */ - if ((knownVMs[0].flag == VM_IF_SERVER_CLASS) && - (ServerClassMachine() == JNI_TRUE)) { - result = knownVMs[0].server_class+1; - } JLI_TraceLauncher("Default VM: %s\n", result); return result; } @@ -1777,15 +1770,14 @@ ShowSettings(JNIEnv *env, char *optString) jclass cls = GetLauncherHelperClass(env); NULL_CHECK(cls); NULL_CHECK(showSettingsID = (*env)->GetStaticMethodID(env, cls, - "showSettings", "(ZLjava/lang/String;JJJZ)V")); + "showSettings", "(ZLjava/lang/String;JJJ)V")); NULL_CHECK(joptString = (*env)->NewStringUTF(env, optString)); (*env)->CallStaticVoidMethod(env, cls, showSettingsID, USE_STDERR, joptString, (jlong)initialHeapSize, (jlong)maxHeapSize, - (jlong)threadStackSize, - ServerClassMachine()); + (jlong)threadStackSize); } /** @@ -1812,7 +1804,7 @@ ListModules(JNIEnv *env, char *optString) static void PrintUsage(JNIEnv* env, jboolean doXUsage) { - jmethodID initHelp, vmSelect, vmSynonym, vmErgo, printHelp, printXUsageMessage; + jmethodID initHelp, vmSelect, vmSynonym, printHelp, printXUsageMessage; jstring jprogname, vm1, vm2; int i; jclass cls = GetLauncherHelperClass(env); @@ -1831,8 +1823,6 @@ PrintUsage(JNIEnv* env, jboolean doXUsage) NULL_CHECK(vmSynonym = (*env)->GetStaticMethodID(env, cls, "appendVmSynonymMessage", "(Ljava/lang/String;Ljava/lang/String;)V")); - NULL_CHECK(vmErgo = (*env)->GetStaticMethodID(env, cls, - "appendVmErgoMessage", "(ZLjava/lang/String;)V")); NULL_CHECK(printHelp = (*env)->GetStaticMethodID(env, cls, "printHelpMessage", "(Z)V")); @@ -1845,13 +1835,6 @@ PrintUsage(JNIEnv* env, jboolean doXUsage) /* Assemble the other variant part of the usage */ - if ((knownVMs[0].flag == VM_KNOWN) || - (knownVMs[0].flag == VM_IF_SERVER_CLASS)) { - NULL_CHECK(vm1 = (*env)->NewStringUTF(env, knownVMs[0].name)); - NULL_CHECK(vm2 = (*env)->NewStringUTF(env, knownVMs[0].name+1)); - (*env)->CallStaticVoidMethod(env, cls, vmSelect, vm1, vm2); - CHECK_EXCEPTION_RETURN(); - } for (i=1; iNewStringUTF(env, knownVMs[i].name)); @@ -1869,20 +1852,6 @@ PrintUsage(JNIEnv* env, jboolean doXUsage) } } - /* The first known VM is the default */ - { - jboolean isServerClassMachine = ServerClassMachine(); - - const char* defaultVM = knownVMs[0].name+1; - if ((knownVMs[0].flag == VM_IF_SERVER_CLASS) && isServerClassMachine) { - defaultVM = knownVMs[0].server_class+1; - } - - NULL_CHECK(vm1 = (*env)->NewStringUTF(env, defaultVM)); - (*env)->CallStaticVoidMethod(env, cls, vmErgo, isServerClassMachine, vm1); - CHECK_EXCEPTION_RETURN(); - } - /* Complete the usage message and print to stderr*/ (*env)->CallStaticVoidMethod(env, cls, printHelp, USE_STDERR); } @@ -2011,19 +1980,7 @@ ReadKnownVMs(const char *jvmCfgName, jboolean speculative) } else if (!JLI_StrCCmp(tmpPtr, "ERROR")) { vmType = VM_ERROR; } else if (!JLI_StrCCmp(tmpPtr, "IF_SERVER_CLASS")) { - tmpPtr += JLI_StrCSpn(tmpPtr, whiteSpace); - if (*tmpPtr != 0) { - tmpPtr += JLI_StrSpn(tmpPtr, whiteSpace); - } - if (*tmpPtr == 0) { - JLI_ReportErrorMessage(CFG_WARN4, lineno, jvmCfgName); - } else { - /* Null terminate server class VM name */ - serverClassVMName = tmpPtr; - tmpPtr += JLI_StrCSpn(tmpPtr, whiteSpace); - *tmpPtr = 0; - vmType = VM_IF_SERVER_CLASS; - } + /* ignored */ } else { JLI_ReportErrorMessage(CFG_WARN5, lineno, &jvmCfgName[0]); vmType = VM_KNOWN; @@ -2043,11 +2000,6 @@ ReadKnownVMs(const char *jvmCfgName, jboolean speculative) JLI_TraceLauncher(" name: %s vmType: %s alias: %s\n", knownVMs[cnt].name, "VM_ALIASED_TO", knownVMs[cnt].alias); break; - case VM_IF_SERVER_CLASS: - knownVMs[cnt].server_class = JLI_StringDup(serverClassVMName); - JLI_TraceLauncher(" name: %s vmType: %s server_class: %s\n", - knownVMs[cnt].name, "VM_IF_SERVER_CLASS", knownVMs[cnt].server_class); - break; } cnt++; } @@ -2197,12 +2149,6 @@ GetLauncherName() return _launcher_name; } -jint -GetErgoPolicy() -{ - return _ergo_policy; -} - jboolean IsJavaArgs() { @@ -2267,17 +2213,6 @@ DumpState() printf("\tlauncher name:%s\n", GetLauncherName()); printf("\tjavaw:%s\n", (IsJavaw() == JNI_TRUE) ? "on" : "off"); printf("\tfullversion:%s\n", GetFullVersion()); - printf("\tergo_policy:"); - switch(GetErgoPolicy()) { - case NEVER_SERVER_CLASS: - printf("NEVER_ACT_AS_A_SERVER_CLASS_MACHINE\n"); - break; - case ALWAYS_SERVER_CLASS: - printf("ALWAYS_ACT_AS_A_SERVER_CLASS_MACHINE\n"); - break; - default: - printf("DEFAULT_ERGONOMICS_POLICY\n"); - } } /* diff --git a/jdk/src/java.base/share/native/libjli/java.h b/jdk/src/java.base/share/native/libjli/java.h index b5056de84a9..189bffc5285 100644 --- a/jdk/src/java.base/share/native/libjli/java.h +++ b/jdk/src/java.base/share/native/libjli/java.h @@ -166,19 +166,10 @@ char *CheckJvmType(int *argc, char ***argv, jboolean speculative); void AddOption(char *str, void *info); jboolean IsWhiteSpaceOption(const char* name); -enum ergo_policy { - DEFAULT_POLICY = 0, - NEVER_SERVER_CLASS, - ALWAYS_SERVER_CLASS -}; - const char* GetProgramName(); const char* GetFullVersion(); jboolean IsJavaArgs(); jboolean IsJavaw(); -jint GetErgoPolicy(); - -jboolean ServerClassMachine(); int ContinueInNewThread(InvocationFunctions* ifn, jlong threadStackSize, int argc, char** argv, diff --git a/jdk/src/java.base/unix/conf/aarch64/jvm.cfg b/jdk/src/java.base/unix/conf/aarch64/jvm.cfg index be6bb934250..deaf28d24b1 100644 --- a/jdk/src/java.base/unix/conf/aarch64/jvm.cfg +++ b/jdk/src/java.base/unix/conf/aarch64/jvm.cfg @@ -21,10 +21,9 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/unix/conf/amd64/jvm.cfg b/jdk/src/java.base/unix/conf/amd64/jvm.cfg index 17c4be37ac9..0642e728b7f 100644 --- a/jdk/src/java.base/unix/conf/amd64/jvm.cfg +++ b/jdk/src/java.base/unix/conf/amd64/jvm.cfg @@ -21,10 +21,9 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/unix/conf/i586/jvm.cfg b/jdk/src/java.base/unix/conf/i586/jvm.cfg index 4be4bb14b5f..58ae999105a 100644 --- a/jdk/src/java.base/unix/conf/i586/jvm.cfg +++ b/jdk/src/java.base/unix/conf/i586/jvm.cfg @@ -23,13 +23,13 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the # "-XXaltjvm=" option, but that too is unsupported # and may not be available in a future release. # --client IF_SERVER_CLASS -server -server KNOWN +-client KNOWN -minimal KNOWN diff --git a/jdk/src/java.base/unix/conf/ia64/jvm.cfg b/jdk/src/java.base/unix/conf/ia64/jvm.cfg index f9d3b5ece40..63cd6690d0a 100644 --- a/jdk/src/java.base/unix/conf/ia64/jvm.cfg +++ b/jdk/src/java.base/unix/conf/ia64/jvm.cfg @@ -1,6 +1,3 @@ -# -# -# # Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -24,11 +21,9 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# -# # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/unix/conf/ppc64/jvm.cfg b/jdk/src/java.base/unix/conf/ppc64/jvm.cfg index 6c024af438f..8fad8561dea 100644 --- a/jdk/src/java.base/unix/conf/ppc64/jvm.cfg +++ b/jdk/src/java.base/unix/conf/ppc64/jvm.cfg @@ -23,7 +23,7 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/unix/conf/ppc64le/jvm.cfg b/jdk/src/java.base/unix/conf/ppc64le/jvm.cfg index 6c024af438f..8fad8561dea 100644 --- a/jdk/src/java.base/unix/conf/ppc64le/jvm.cfg +++ b/jdk/src/java.base/unix/conf/ppc64le/jvm.cfg @@ -23,7 +23,7 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/unix/conf/s390x/jvm.cfg b/jdk/src/java.base/unix/conf/s390x/jvm.cfg index 2c147c9b97d..567857e64ba 100644 --- a/jdk/src/java.base/unix/conf/s390x/jvm.cfg +++ b/jdk/src/java.base/unix/conf/s390x/jvm.cfg @@ -23,7 +23,7 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/unix/conf/sparc/jvm.cfg b/jdk/src/java.base/unix/conf/sparc/jvm.cfg index 4be4bb14b5f..fae21410cd9 100644 --- a/jdk/src/java.base/unix/conf/sparc/jvm.cfg +++ b/jdk/src/java.base/unix/conf/sparc/jvm.cfg @@ -1,4 +1,4 @@ -# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2001, 2016, 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,13 +23,13 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the # "-XXaltjvm=" option, but that too is unsupported # and may not be available in a future release. # --client IF_SERVER_CLASS -server -server KNOWN +-client KNOWN -minimal KNOWN diff --git a/jdk/src/java.base/unix/conf/sparcv9/jvm.cfg b/jdk/src/java.base/unix/conf/sparcv9/jvm.cfg index 84f6d2706e8..0c4ef90bbd5 100644 --- a/jdk/src/java.base/unix/conf/sparcv9/jvm.cfg +++ b/jdk/src/java.base/unix/conf/sparcv9/jvm.cfg @@ -23,7 +23,7 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/unix/conf/zero/jvm.cfg b/jdk/src/java.base/unix/conf/zero/jvm.cfg index 1b8d52792bc..38f1d8003da 100644 --- a/jdk/src/java.base/unix/conf/zero/jvm.cfg +++ b/jdk/src/java.base/unix/conf/zero/jvm.cfg @@ -21,10 +21,9 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/unix/native/libjli/ergo.c b/jdk/src/java.base/unix/native/libjli/ergo.c deleted file mode 100644 index 2047087e7c5..00000000000 --- a/jdk/src/java.base/unix/native/libjli/ergo.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1998, 2011, 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. - */ - -/* This file houses the common methods for VM ergonomics the platforms - * are split into ergo_sparc and ergo_x86, and they could be split more - * in the future if required. The following comments are not entirely - * true after bifurcation of the platform specific files. - */ - -/* - * The following methods (down to ServerClassMachine()) answer - * the question about whether a machine is a "server-class" - * machine. A server-class machine is loosely defined as one - * with 2 or more processors and 2 gigabytes or more physical - * memory. The definition of a processor is a physical package, - * not a hyperthreaded chip masquerading as a multi-processor. - * The definition of memory is also somewhat fuzzy, since x86 - * machines seem not to report all the memory in their DIMMs, we - * think because of memory mapping of graphics cards, etc. - * - * This code is somewhat more confused with #ifdef's than we'd - * like because this file is used by both Solaris and Linux - * platforms, and so needs to be parameterized for SPARC and - * i586 hardware. The other Linux platforms (amd64 and ia64) - * don't even ask this question, because they only come with - * server JVMs. - */ - -#include "ergo.h" - -/* Dispatch to the platform-specific definition of "server-class" */ -jboolean -ServerClassMachine(void) { - jboolean result; - switch(GetErgoPolicy()) { - case NEVER_SERVER_CLASS: - return JNI_FALSE; - case ALWAYS_SERVER_CLASS: - return JNI_TRUE; - default: - result = ServerClassMachineImpl(); - JLI_TraceLauncher("ServerClassMachine: returns default value of %s\n", - (result == JNI_TRUE ? "true" : "false")); - return result; - } -} - -#ifdef USE_GENERIC_ERGO -/* Ask the OS how many processors there are. */ -static unsigned long -physical_processors(void) { - const unsigned long sys_processors = sysconf(_SC_NPROCESSORS_CONF); - JLI_TraceLauncher("sysconf(_SC_NPROCESSORS_CONF): %lu\n", sys_processors); - return sys_processors; -} - -jboolean -ServerClassMachineImpl(void) { - jboolean result = JNI_FALSE; - /* How big is a server class machine? */ - const unsigned long server_processors = 2UL; - const uint64_t server_memory = 2UL * GB; - const uint64_t actual_memory = physical_memory(); - - /* Is this a server class machine? */ - if (actual_memory >= server_memory) { - const unsigned long actual_processors = physical_processors(); - if (actual_processors >= server_processors) { - result = JNI_TRUE; - } - } - JLI_TraceLauncher("unix_" LIBARCHNAME "_ServerClassMachine: %s\n", - (result == JNI_TRUE ? "JNI_TRUE" : "JNI_FALSE")); - return result; -} -#endif - -/* Compute physical memory by asking the OS */ -uint64_t -physical_memory(void) { - const uint64_t pages = (uint64_t) sysconf(_SC_PHYS_PAGES); - const uint64_t page_size = (uint64_t) sysconf(_SC_PAGESIZE); - const uint64_t result = pages * page_size; -# define UINT64_FORMAT "%" PRIu64 - - JLI_TraceLauncher("pages: " UINT64_FORMAT - " page_size: " UINT64_FORMAT - " physical memory: " UINT64_FORMAT " (%.3fGB)\n", - pages, page_size, result, result / (double) GB); - return result; -} diff --git a/jdk/src/java.base/unix/native/libjli/ergo.h b/jdk/src/java.base/unix/native/libjli/ergo.h deleted file mode 100644 index 4f146e0e678..00000000000 --- a/jdk/src/java.base/unix/native/libjli/ergo.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1998, 2005, 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. - */ - -#ifndef _ERGO_H -#define _ERGO_H - -#include -#include -#include -#include -#include -#include -#include - -#include "java.h" - -jboolean ServerClassMachineImpl(void); -uint64_t physical_memory(void); - -#endif /* _ERGO_H */ diff --git a/jdk/src/java.base/unix/native/libjli/ergo_i586.c b/jdk/src/java.base/unix/native/libjli/ergo_i586.c deleted file mode 100644 index f2421700289..00000000000 --- a/jdk/src/java.base/unix/native/libjli/ergo_i586.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 1998, 2007, 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. - */ - -#include "ergo.h" - -static unsigned long physical_processors(void); - -#ifdef __solaris__ - -/* - * A utility method for asking the CPU about itself. - * There's a corresponding version of linux-i586 - * because the compilers are different. - */ -static void -get_cpuid(uint32_t arg, - uint32_t* eaxp, - uint32_t* ebxp, - uint32_t* ecxp, - uint32_t* edxp) { -#ifdef _LP64 - asm( - /* rbx is a callee-saved register */ - " movq %rbx, %r11 \n" - /* rdx and rcx are 3rd and 4th argument registers */ - " movq %rdx, %r10 \n" - " movq %rcx, %r9 \n" - " movl %edi, %eax \n" - " cpuid \n" - " movl %eax, (%rsi)\n" - " movl %ebx, (%r10)\n" - " movl %ecx, (%r9) \n" - " movl %edx, (%r8) \n" - /* Restore rbx */ - " movq %r11, %rbx"); -#else - /* EBX is a callee-saved register */ - asm(" pushl %ebx"); - /* Need ESI for storing through arguments */ - asm(" pushl %esi"); - asm(" movl 8(%ebp), %eax \n" - " cpuid \n" - " movl 12(%ebp), %esi \n" - " movl %eax, (%esi) \n" - " movl 16(%ebp), %esi \n" - " movl %ebx, (%esi) \n" - " movl 20(%ebp), %esi \n" - " movl %ecx, (%esi) \n" - " movl 24(%ebp), %esi \n" - " movl %edx, (%esi) "); - /* Restore ESI and EBX */ - asm(" popl %esi"); - /* Restore EBX */ - asm(" popl %ebx"); -#endif /* LP64 */ -} - -/* The definition of a server-class machine for solaris-i586/amd64 */ -jboolean -ServerClassMachineImpl(void) { - jboolean result = JNI_FALSE; - /* How big is a server class machine? */ - const unsigned long server_processors = 2UL; - const uint64_t server_memory = 2UL * GB; - /* - * We seem not to get our full complement of memory. - * We allow some part (1/8?) of the memory to be "missing", - * based on the sizes of DIMMs, and maybe graphics cards. - */ - const uint64_t missing_memory = 256UL * MB; - const uint64_t actual_memory = physical_memory(); - - /* Is this a server class machine? */ - if (actual_memory >= (server_memory - missing_memory)) { - const unsigned long actual_processors = physical_processors(); - if (actual_processors >= server_processors) { - result = JNI_TRUE; - } - } - JLI_TraceLauncher("solaris_" LIBARCHNAME "_ServerClassMachine: %s\n", - (result == JNI_TRUE ? "true" : "false")); - return result; -} - -#endif /* __solaris__ */ - -#ifdef __linux__ - -/* - * A utility method for asking the CPU about itself. - * There's a corresponding version of solaris-i586 - * because the compilers are different. - */ -static void -get_cpuid(uint32_t arg, - uint32_t* eaxp, - uint32_t* ebxp, - uint32_t* ecxp, - uint32_t* edxp) { -#ifdef _LP64 - __asm__ volatile (/* Instructions */ - " movl %4, %%eax \n" - " cpuid \n" - " movl %%eax, (%0)\n" - " movl %%ebx, (%1)\n" - " movl %%ecx, (%2)\n" - " movl %%edx, (%3)\n" - : /* Outputs */ - : /* Inputs */ - "r" (eaxp), - "r" (ebxp), - "r" (ecxp), - "r" (edxp), - "r" (arg) - : /* Clobbers */ - "%rax", "%rbx", "%rcx", "%rdx", "memory" - ); -#else /* _LP64 */ - uint32_t value_of_eax = 0; - uint32_t value_of_ebx = 0; - uint32_t value_of_ecx = 0; - uint32_t value_of_edx = 0; - __asm__ volatile (/* Instructions */ - /* ebx is callee-save, so push it */ - " pushl %%ebx \n" - " movl %4, %%eax \n" - " cpuid \n" - " movl %%eax, %0 \n" - " movl %%ebx, %1 \n" - " movl %%ecx, %2 \n" - " movl %%edx, %3 \n" - /* restore ebx */ - " popl %%ebx \n" - - : /* Outputs */ - "=m" (value_of_eax), - "=m" (value_of_ebx), - "=m" (value_of_ecx), - "=m" (value_of_edx) - : /* Inputs */ - "m" (arg) - : /* Clobbers */ - "%eax", "%ecx", "%edx" - ); - *eaxp = value_of_eax; - *ebxp = value_of_ebx; - *ecxp = value_of_ecx; - *edxp = value_of_edx; -#endif /* _LP64 */ -} - -/* The definition of a server-class machine for linux-i586 */ -jboolean -ServerClassMachineImpl(void) { - jboolean result = JNI_FALSE; - /* How big is a server class machine? */ - const unsigned long server_processors = 2UL; - const uint64_t server_memory = 2UL * GB; - /* - * We seem not to get our full complement of memory. - * We allow some part (1/8?) of the memory to be "missing", - * based on the sizes of DIMMs, and maybe graphics cards. - */ - const uint64_t missing_memory = 256UL * MB; - const uint64_t actual_memory = physical_memory(); - - /* Is this a server class machine? */ - if (actual_memory >= (server_memory - missing_memory)) { - const unsigned long actual_processors = physical_processors(); - if (actual_processors >= server_processors) { - result = JNI_TRUE; - } - } - JLI_TraceLauncher("linux_" LIBARCHNAME "_ServerClassMachine: %s\n", - (result == JNI_TRUE ? "true" : "false")); - return result; -} -#endif /* __linux__ */ - -/* - * Routines shared by solaris-i586 and linux-i586. - */ - -enum HyperThreadingSupport_enum { - hts_supported = 1, - hts_too_soon_to_tell = 0, - hts_not_supported = -1, - hts_not_pentium4 = -2, - hts_not_intel = -3 -}; -typedef enum HyperThreadingSupport_enum HyperThreadingSupport; - -/* Determine if hyperthreading is supported */ -static HyperThreadingSupport -hyperthreading_support(void) { - HyperThreadingSupport result = hts_too_soon_to_tell; - /* Bits 11 through 8 is family processor id */ -# define FAMILY_ID_SHIFT 8 -# define FAMILY_ID_MASK 0xf - /* Bits 23 through 20 is extended family processor id */ -# define EXT_FAMILY_ID_SHIFT 20 -# define EXT_FAMILY_ID_MASK 0xf - /* Pentium 4 family processor id */ -# define PENTIUM4_FAMILY_ID 0xf - /* Bit 28 indicates Hyper-Threading Technology support */ -# define HT_BIT_SHIFT 28 -# define HT_BIT_MASK 1 - uint32_t vendor_id[3] = { 0U, 0U, 0U }; - uint32_t value_of_eax = 0U; - uint32_t value_of_edx = 0U; - uint32_t dummy = 0U; - - /* Yes, this is supposed to be [0], [2], [1] */ - get_cpuid(0, &dummy, &vendor_id[0], &vendor_id[2], &vendor_id[1]); - JLI_TraceLauncher("vendor: %c %c %c %c %c %c %c %c %c %c %c %c \n", - ((vendor_id[0] >> 0) & 0xff), - ((vendor_id[0] >> 8) & 0xff), - ((vendor_id[0] >> 16) & 0xff), - ((vendor_id[0] >> 24) & 0xff), - ((vendor_id[1] >> 0) & 0xff), - ((vendor_id[1] >> 8) & 0xff), - ((vendor_id[1] >> 16) & 0xff), - ((vendor_id[1] >> 24) & 0xff), - ((vendor_id[2] >> 0) & 0xff), - ((vendor_id[2] >> 8) & 0xff), - ((vendor_id[2] >> 16) & 0xff), - ((vendor_id[2] >> 24) & 0xff)); - get_cpuid(1, &value_of_eax, &dummy, &dummy, &value_of_edx); - JLI_TraceLauncher("value_of_eax: 0x%x value_of_edx: 0x%x\n", - value_of_eax, value_of_edx); - if ((((value_of_eax >> FAMILY_ID_SHIFT) & FAMILY_ID_MASK) == PENTIUM4_FAMILY_ID) || - (((value_of_eax >> EXT_FAMILY_ID_SHIFT) & EXT_FAMILY_ID_MASK) != 0)) { - if ((((vendor_id[0] >> 0) & 0xff) == 'G') && - (((vendor_id[0] >> 8) & 0xff) == 'e') && - (((vendor_id[0] >> 16) & 0xff) == 'n') && - (((vendor_id[0] >> 24) & 0xff) == 'u') && - (((vendor_id[1] >> 0) & 0xff) == 'i') && - (((vendor_id[1] >> 8) & 0xff) == 'n') && - (((vendor_id[1] >> 16) & 0xff) == 'e') && - (((vendor_id[1] >> 24) & 0xff) == 'I') && - (((vendor_id[2] >> 0) & 0xff) == 'n') && - (((vendor_id[2] >> 8) & 0xff) == 't') && - (((vendor_id[2] >> 16) & 0xff) == 'e') && - (((vendor_id[2] >> 24) & 0xff) == 'l')) { - if (((value_of_edx >> HT_BIT_SHIFT) & HT_BIT_MASK) == HT_BIT_MASK) { - JLI_TraceLauncher("Hyperthreading supported\n"); - result = hts_supported; - } else { - JLI_TraceLauncher("Hyperthreading not supported\n"); - result = hts_not_supported; - } - } else { - JLI_TraceLauncher("Not GenuineIntel\n"); - result = hts_not_intel; - } - } else { - JLI_TraceLauncher("not Pentium 4 or extended\n"); - result = hts_not_pentium4; - } - return result; -} - -/* Determine how many logical processors there are per CPU */ -static unsigned int -logical_processors_per_package(void) { - /* - * After CPUID with EAX==1, register EBX bits 23 through 16 - * indicate the number of logical processors per package - */ -# define NUM_LOGICAL_SHIFT 16 -# define NUM_LOGICAL_MASK 0xff - unsigned int result = 1U; - const HyperThreadingSupport hyperthreading = hyperthreading_support(); - - if (hyperthreading == hts_supported) { - uint32_t value_of_ebx = 0U; - uint32_t dummy = 0U; - - get_cpuid(1, &dummy, &value_of_ebx, &dummy, &dummy); - result = (value_of_ebx >> NUM_LOGICAL_SHIFT) & NUM_LOGICAL_MASK; - JLI_TraceLauncher("logical processors per package: %u\n", result); - } - return result; -} - -/* Compute the number of physical processors, not logical processors */ -static unsigned long -physical_processors(void) { - const long sys_processors = sysconf(_SC_NPROCESSORS_CONF); - unsigned long result = sys_processors; - - JLI_TraceLauncher("sysconf(_SC_NPROCESSORS_CONF): %lu\n", sys_processors); - if (sys_processors > 1) { - unsigned int logical_processors = logical_processors_per_package(); - if (logical_processors > 1) { - result = (unsigned long) sys_processors / logical_processors; - } - } - JLI_TraceLauncher("physical processors: %lu\n", result); - return result; -} diff --git a/jdk/src/java.base/windows/conf/amd64/jvm.cfg b/jdk/src/java.base/windows/conf/amd64/jvm.cfg index 21ab9fd0fde..41ef6cb7e1a 100644 --- a/jdk/src/java.base/windows/conf/amd64/jvm.cfg +++ b/jdk/src/java.base/windows/conf/amd64/jvm.cfg @@ -1,6 +1,3 @@ -# -# -# # Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -27,7 +24,7 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/windows/conf/i586/jvm.cfg b/jdk/src/java.base/windows/conf/i586/jvm.cfg index 2bacbb66feb..895ab8962c5 100644 --- a/jdk/src/java.base/windows/conf/i586/jvm.cfg +++ b/jdk/src/java.base/windows/conf/i586/jvm.cfg @@ -23,7 +23,7 @@ # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/windows/conf/ia64/jvm.cfg b/jdk/src/java.base/windows/conf/ia64/jvm.cfg index ac0c8084224..63cd6690d0a 100644 --- a/jdk/src/java.base/windows/conf/ia64/jvm.cfg +++ b/jdk/src/java.base/windows/conf/ia64/jvm.cfg @@ -1,6 +1,3 @@ -# -# -# # Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -24,10 +21,9 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. -# NOTE that this both this file and its format are UNSUPPORTED and +# NOTE that both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the diff --git a/jdk/src/java.base/windows/native/libjli/java_md.c b/jdk/src/java.base/windows/native/libjli/java_md.c index 1db3c408740..adb90a50cc4 100644 --- a/jdk/src/java.base/windows/native/libjli/java_md.c +++ b/jdk/src/java.base/windows/native/libjli/java_md.c @@ -639,11 +639,6 @@ void JLI_ReportExceptionDescription(JNIEnv * env) { } } -jboolean -ServerClassMachine() { - return (GetErgoPolicy() == ALWAYS_SERVER_CLASS) ? JNI_TRUE : JNI_FALSE; -} - /* * Wrapper for platform dependent unsetenv function. */ From 7b4b8a2eec591a7ba3dd64f8428cc593dcc61bcb Mon Sep 17 00:00:00 2001 From: Amy Lu Date: Fri, 11 Nov 2016 11:31:17 +0800 Subject: [PATCH 15/54] 8169041: com/sun/corba/cachedSocket should be added to exclusiveAccess.dirs Reviewed-by: chegar --- jdk/test/TEST.ROOT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/TEST.ROOT b/jdk/test/TEST.ROOT index 8a4164133fe..1e703488ea6 100644 --- a/jdk/test/TEST.ROOT +++ b/jdk/test/TEST.ROOT @@ -18,7 +18,7 @@ keys=2d dnd i18n intermittent randomness headful othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation java/lang/ProcessHandle # Tests that cannot run concurrently -exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream javax/rmi +exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream javax/rmi com/sun/corba/cachedSocket # Group definitions groups=TEST.groups [closed/TEST.groups] From 6764a3bc32216348c394197282c3fe7caea61b6a Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Fri, 11 Nov 2016 05:11:53 +0000 Subject: [PATCH 16/54] Added tag jdk-9+144 for changeset 612b698f8b8f --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 508a3a48852..d39ded9908c 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -386,3 +386,4 @@ e93b7ea559759f036c9f69fd2ddaf47bb4e98385 jdk-9+140 8d752af5f61d41f226adf2cda72a20faa9ad620a jdk-9+141 6ce43dd8e954b452f330dd7a412df5107f7e1923 jdk-9+142 8dbc8594f9d5149bf1c22221272284609408227a jdk-9+143 +efa71dc820eb8bd5a6c9f2f66f39c383ac3ee99d jdk-9+144 From 9889b2205653177bfff36d2cf396d6ef64f4e4eb Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Fri, 11 Nov 2016 13:11:27 +0000 Subject: [PATCH 17/54] 8164815: 3 JCK NetworkInterface tests fail on Raspberry Pi Reviewed-by: chegar, alanb --- .../classes/java/net/NetworkInterface.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java index f505bc48a82..960024f939d 100644 --- a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java +++ b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -335,15 +335,19 @@ public final class NetworkInterface { * {@link #getInetAddresses()} to obtain all IP addresses for this node * * @return an Enumeration of NetworkInterfaces found on this machine - * @exception SocketException if an I/O error occurs. + * @exception SocketException if an I/O error occurs, + * or if the platform does not have at least one configured + * network interface. * @see #networkInterfaces() */ public static Enumeration getNetworkInterfaces() throws SocketException { NetworkInterface[] netifs = getAll(); - assert netifs != null && netifs.length > 0; - - return enumerationFromArray(netifs); + if (netifs != null && netifs.length > 0) { + return enumerationFromArray(netifs); + } else { + throw new SocketException("No network interfaces configured"); + } } /** @@ -361,15 +365,19 @@ public final class NetworkInterface { * } * * @return a Stream of NetworkInterfaces found on this machine - * @exception SocketException if an I/O error occurs. + * @exception SocketException if an I/O error occurs, + * or if the platform does not have at least one configured + * network interface. * @since 9 */ public static Stream networkInterfaces() throws SocketException { NetworkInterface[] netifs = getAll(); - assert netifs != null && netifs.length > 0; - - return streamFromArray(netifs); + if (netifs != null && netifs.length > 0) { + return streamFromArray(netifs); + } else { + throw new SocketException("No network interfaces configured"); + } } private static Enumeration enumerationFromArray(T[] a) { From eab488fc011d24f1209e122ce1c40ce842167b3d Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 14 Nov 2016 10:07:10 +0100 Subject: [PATCH 18/54] 8169595: jshell tool: pasting multiple lines hangs input Need to allow newlines in the user's input. Reviewed-by: rfield --- .../share/classes/jdk/internal/jline/console/ConsoleReader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java index 999b0f7bd91..a7f26871f28 100644 --- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java +++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java @@ -3222,7 +3222,7 @@ public class ConsoleReader } //where: private Pattern CURSOR_COLUMN_PATTERN = - Pattern.compile("(?.*)\033\\[[0-9]+;(?[0-9]+)R"); + Pattern.compile("(?.*)\033\\[[0-9]+;(?[0-9]+)R", Pattern.DOTALL); /** * Read a line for unsupported terminals. From 6cbbf83a1acdd5efea4d8f888260983c2a3533ca Mon Sep 17 00:00:00 2001 From: Sunny Chan Date: Thu, 28 Jan 2016 23:13:50 -0500 Subject: [PATCH 19/54] 8169556: Wrapping of FileInputStream's native skip and available methods Wrap further native methods in FileInputStreams Reviewed-by: chegar, bpb, rriggs --- jdk/make/mapfiles/libjava/mapfile-vers | 4 ++-- jdk/make/mapfiles/libjava/reorder-sparc | 2 +- jdk/make/mapfiles/libjava/reorder-sparcv9 | 2 +- jdk/make/mapfiles/libjava/reorder-x86 | 2 +- .../share/classes/java/io/FileInputStream.java | 12 ++++++++++-- .../java.base/share/native/libjava/FileInputStream.c | 4 ++-- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers index f0e3f2bb076..5d7cc4a655f 100644 --- a/jdk/make/mapfiles/libjava/mapfile-vers +++ b/jdk/make/mapfiles/libjava/mapfile-vers @@ -77,13 +77,13 @@ SUNWprivate_1.1 { Java_java_io_FileDescriptor_initIDs; Java_java_io_FileDescriptor_sync; Java_java_io_FileDescriptor_getAppend; - Java_java_io_FileInputStream_available; + Java_java_io_FileInputStream_available0; Java_java_io_FileInputStream_close0; Java_java_io_FileInputStream_initIDs; Java_java_io_FileInputStream_open0; Java_java_io_FileInputStream_read0; Java_java_io_FileInputStream_readBytes; - Java_java_io_FileInputStream_skip; + Java_java_io_FileInputStream_skip0; Java_java_io_FileOutputStream_close0; Java_java_io_FileOutputStream_initIDs; Java_java_io_FileOutputStream_open0; diff --git a/jdk/make/mapfiles/libjava/reorder-sparc b/jdk/make/mapfiles/libjava/reorder-sparc index 6743ccedfaa..da91bfb6f68 100644 --- a/jdk/make/mapfiles/libjava/reorder-sparc +++ b/jdk/make/mapfiles/libjava/reorder-sparc @@ -44,7 +44,7 @@ text: .text%Java_java_io_FileInputStream_open0; text: .text%fileOpen; text: .text%Java_java_io_FileInputStream_readBytes; text: .text%readBytes; -text: .text%Java_java_io_FileInputStream_available; +text: .text%Java_java_io_FileInputStream_available0; text: .text%Java_java_io_FileInputStream_close0; text: .text%Java_java_lang_System_mapLibraryName; text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0; diff --git a/jdk/make/mapfiles/libjava/reorder-sparcv9 b/jdk/make/mapfiles/libjava/reorder-sparcv9 index 877d2d79b5e..aa605871ecc 100644 --- a/jdk/make/mapfiles/libjava/reorder-sparcv9 +++ b/jdk/make/mapfiles/libjava/reorder-sparcv9 @@ -48,7 +48,7 @@ text: .text%Java_java_io_FileInputStream_open0; text: .text%fileOpen; text: .text%Java_java_io_FileInputStream_readBytes; text: .text%readBytes; -text: .text%Java_java_io_FileInputStream_available; +text: .text%Java_java_io_FileInputStream_available0; text: .text%Java_java_io_FileInputStream_close0; text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2; text: .text%Java_java_io_UnixFileSystem_list; diff --git a/jdk/make/mapfiles/libjava/reorder-x86 b/jdk/make/mapfiles/libjava/reorder-x86 index d0407001e62..4e3e9365561 100644 --- a/jdk/make/mapfiles/libjava/reorder-x86 +++ b/jdk/make/mapfiles/libjava/reorder-x86 @@ -76,7 +76,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri text: .text%JNU_GetEnv; text: .text%Java_java_io_UnixFileSystem_checkAccess; text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0; -text: .text%Java_java_io_FileInputStream_available; +text: .text%Java_java_io_FileInputStream_available0; text: .text%Java_java_lang_reflect_Array_newArray; text: .text%Java_java_lang_StackTraceElement_initStackTraceElements; text: .text%Java_java_lang_System_identityHashCode; diff --git a/jdk/src/java.base/share/classes/java/io/FileInputStream.java b/jdk/src/java.base/share/classes/java/io/FileInputStream.java index 713b2ad0e95..a321c61ae41 100644 --- a/jdk/src/java.base/share/classes/java/io/FileInputStream.java +++ b/jdk/src/java.base/share/classes/java/io/FileInputStream.java @@ -280,7 +280,11 @@ class FileInputStream extends InputStream * @exception IOException if n is negative, if the stream does not * support seek, or if an I/O error occurs. */ - public native long skip(long n) throws IOException; + public long skip(long n) throws IOException { + return skip0(n); + } + + private native long skip0(long n) throws IOException; /** * Returns an estimate of the number of remaining bytes that can be read (or @@ -299,7 +303,11 @@ class FileInputStream extends InputStream * @exception IOException if this file input stream has been closed by calling * {@code close} or an I/O error occurs. */ - public native int available() throws IOException; + public int available() throws IOException { + return available0(); + } + + private native int available0() throws IOException; /** * Closes this file input stream and releases any system resources diff --git a/jdk/src/java.base/share/native/libjava/FileInputStream.c b/jdk/src/java.base/share/native/libjava/FileInputStream.c index d0e23897015..44122a87b27 100644 --- a/jdk/src/java.base/share/native/libjava/FileInputStream.c +++ b/jdk/src/java.base/share/native/libjava/FileInputStream.c @@ -73,7 +73,7 @@ Java_java_io_FileInputStream_readBytes(JNIEnv *env, jobject this, } JNIEXPORT jlong JNICALL -Java_java_io_FileInputStream_skip(JNIEnv *env, jobject this, jlong toSkip) { +Java_java_io_FileInputStream_skip0(JNIEnv *env, jobject this, jlong toSkip) { jlong cur = jlong_zero; jlong end = jlong_zero; FD fd = GET_FD(this, fis_fd); @@ -90,7 +90,7 @@ Java_java_io_FileInputStream_skip(JNIEnv *env, jobject this, jlong toSkip) { } JNIEXPORT jint JNICALL -Java_java_io_FileInputStream_available(JNIEnv *env, jobject this) { +Java_java_io_FileInputStream_available0(JNIEnv *env, jobject this) { jlong ret; FD fd = GET_FD(this, fis_fd); if (fd == -1) { From d2b993e2ab96fbc4a10d321c18a8e37545a02d1e Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Wed, 28 Sep 2016 16:41:38 +0200 Subject: [PATCH 20/54] 8166790: Add stress test GCBasher Reviewed-by: dfazunen, dholmes, erikj, tschatzl, lmesnik --- make/jprt.properties | 50 +++++++++++++------------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/make/jprt.properties b/make/jprt.properties index 2130ae6b5db..9a01ad3db7a 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -334,11 +334,7 @@ my.test.targets.hotspot.solaris.sparcv9= \ solaris_sparcv9_5.11-{product|fastdebug}-c2-jvm98, \ solaris_sparcv9_5.11-{product|fastdebug}-c2-jvm98_nontiered, \ solaris_sparcv9_5.11-{product|fastdebug}-c2-scimark, \ - solaris_sparcv9_5.11-product-c2-runThese8, \ - solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_SerialGC, \ - solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_ParallelGC, \ - solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_CMS, \ - solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_G1 + solaris_sparcv9_5.11-product-c2-runThese8, my.test.targets.hotspot.solaris.x64= \ solaris_x64_5.11-{product|fastdebug}-c2-jvm98, \ @@ -346,40 +342,24 @@ my.test.targets.hotspot.solaris.x64= \ solaris_x64_5.11-{product|fastdebug}-c2-scimark, \ solaris_x64_5.11-product-c2-runThese8, \ solaris_x64_5.11-product-c2-runThese8_Xcomp_lang, \ - solaris_x64_5.11-product-c2-runThese8_Xcomp_vm, \ - solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_SerialGC, \ - solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_ParallelGC, \ - solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_CMS, \ - solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_G1 + solaris_x64_5.11-product-c2-runThese8_Xcomp_vm, my.test.targets.hotspot.linux.i586= \ linux_i586_3.8-{product|fastdebug}-c2-jvm98, \ linux_i586_3.8-{product|fastdebug}-c2-jvm98_nontiered, \ linux_i586_3.8-{product|fastdebug}-c2-scimark, \ linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_lang, \ - linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_vm, \ - linux_i586_3.8-{product|fastdebug}-c2-GCBasher_SerialGC, \ - linux_i586_3.8-{product|fastdebug}-c2-GCBasher_ParallelGC, \ - linux_i586_3.8-{product|fastdebug}-c2-GCBasher_CMS, \ - linux_i586_3.8-{product|fastdebug}-c2-GCBasher_G1 + linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_vm my.test.targets.hotspot.linux.x64= \ linux_x64_3.8-{product|fastdebug}-c2-jvm98, \ linux_x64_3.8-{product|fastdebug}-c2-jvm98_nontiered, \ - linux_x64_3.8-{product|fastdebug}-c2-scimark, \ - linux_x64_3.8-{product|fastdebug}-c2-GCBasher_SerialGC, \ - linux_x64_3.8-{product|fastdebug}-c2-GCBasher_ParallelGC, \ - linux_x64_3.8-{product|fastdebug}-c2-GCBasher_CMS, \ - linux_x64_3.8-{product|fastdebug}-c2-GCBasher_G1 + linux_x64_3.8-{product|fastdebug}-c2-scimark my.test.targets.hotspot.macosx.x64= \ macosx_x64_10.9-{product|fastdebug}-c2-jvm98, \ macosx_x64_10.9-{product|fastdebug}-c2-jvm98_nontiered, \ - macosx_x64_10.9-{product|fastdebug}-c2-scimark, \ - macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_SerialGC, \ - macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_ParallelGC, \ - macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_CMS, \ - macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_G1 + macosx_x64_10.9-{product|fastdebug}-c2-scimark my.test.targets.hotspot.windows.i586= \ windows_i586_6.3-{product|fastdebug}-c2-jvm98, \ @@ -387,11 +367,7 @@ my.test.targets.hotspot.windows.i586= \ windows_i586_6.3-{product|fastdebug}-c2-scimark, \ windows_i586_6.3-product-c2-runThese8, \ windows_i586_6.3-product-c2-runThese8_Xcomp_lang, \ - windows_i586_6.3-product-c2-runThese8_Xcomp_vm, \ - windows_i586_6.3-{product|fastdebug}-c2-GCBasher_SerialGC, \ - windows_i586_6.3-{product|fastdebug}-c2-GCBasher_ParallelGC, \ - windows_i586_6.3-{product|fastdebug}-c2-GCBasher_CMS, \ - windows_i586_6.3-{product|fastdebug}-c2-GCBasher_G1 + windows_i586_6.3-product-c2-runThese8_Xcomp_vm, my.test.targets.hotspot.windows.x64= \ windows_x64_6.3-{product|fastdebug}-c2-jvm98, \ @@ -399,11 +375,7 @@ my.test.targets.hotspot.windows.x64= \ windows_x64_6.3-{product|fastdebug}-c2-scimark, \ windows_x64_6.3-product-c2-runThese8, \ windows_x64_6.3-product-c2-runThese8_Xcomp_lang, \ - windows_x64_6.3-product-c2-runThese8_Xcomp_vm, \ - windows_x64_6.3-{product|fastdebug}-c2-GCBasher_SerialGC, \ - windows_x64_6.3-{product|fastdebug}-c2-GCBasher_ParallelGC, \ - windows_x64_6.3-{product|fastdebug}-c2-GCBasher_CMS, \ - windows_x64_6.3-{product|fastdebug}-c2-GCBasher_G1 + windows_x64_6.3-product-c2-runThese8_Xcomp_vm, # Some basic "smoke" tests for OpenJDK builds my.test.targets.hotspot.open= \ @@ -468,9 +440,17 @@ my.make.rule.test.targets.hotspot.reg= \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_2}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_closed}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_gcold}, \ + ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_gcbasher}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_runtime}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_serviceability}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=jdk_svc_sanity}, \ + solaris_sparcv9_5.11-product-c2-hotspot_fast_gc_gcbasher, \ + solaris_x64_5.11-product-c2-hotspot_fast_gc_gcbasher, \ + linux_i586_3.8-product-c2-hotspot_fast_gc_gcbasher, \ + linux_x64_3.8-product-c2-hotspot_fast_gc_gcbasher, \ + macosx_x64_10.9-product-c2-hotspot_fast_gc_gcbasher, \ + windows_i586_6.3-product-c2-hotspot_fast_gc_gcbasher, \ + windows_x64_6.3-product-c2-hotspot_fast_gc_gcbasher, \ ${my.additional.make.rule.test.targets.hotspot.reg} # Other Makefile based Hotspot tests From 0d6e939abfe6462f3b7463381fbb631dc563f9e0 Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Thu, 20 Oct 2016 16:53:35 +0300 Subject: [PATCH 21/54] 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java Reviewed-by: kvn --- test/jtreg-ext/requires/VMProps.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index 644c8cd366c..5c088b6008a 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -59,6 +59,7 @@ public class VMProps implements Callable> { map.put("vm.bits", vmBits()); map.put("vm.flightRecorder", vmFlightRecorder()); map.put("vm.simpleArch", vmArch()); + map.put("vm.debug", vmDebug()); vmGC(map); // vm.gc.X = true/false dump(map); @@ -147,6 +148,13 @@ public class VMProps implements Callable> { return "false"; } + /** + * @return debug level value extracted from the "jdk.debug" property. + */ + protected String vmDebug() { + return "" + System.getProperty("jdk.debug").contains("debug"); + } + /** * For all existing GC sets vm.gc.X property. * Example vm.gc.G1=true means: From 5320830885ca1c535f911929dc67bbc8c1492dd9 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Fri, 21 Oct 2016 15:40:47 +0200 Subject: [PATCH 22/54] 8168412: Reduce buffering in jtreg timeouthandler Reviewed-by: mlarsson --- .../share/classes/jdk/test/failurehandler/HtmlSection.java | 2 +- .../failurehandler/jtreg/GatherDiagnosticInfoObserver.java | 4 ++-- .../jtreg/GatherProcessInfoTimeoutHandler.java | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java index 0597fe7b206..d20b13360a5 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java @@ -49,7 +49,7 @@ public class HtmlSection { private HtmlSection(PrintWriter pw, String id, String name, HtmlSection rootSection) { this.pw = pw; - textWriter = new PrintWriter(new HtmlFilterWriter(pw)); + textWriter = new PrintWriter(new HtmlFilterWriter(pw), true); this.id = id; this.name = name; child = null; diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java index 5eb67163f80..7a14d3797fc 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java @@ -68,7 +68,7 @@ public class GatherDiagnosticInfoObserver implements Harness.Observer { boolean needClose = false; try { log = new PrintWriter(new FileWriter( - workDir.resolve(LOG_FILENAME).toFile(), true)); + workDir.resolve(LOG_FILENAME).toFile(), true), true); needClose = true; } catch (IOException e) { log = new PrintWriter(System.out); @@ -100,7 +100,7 @@ public class GatherDiagnosticInfoObserver implements Harness.Observer { EnvironmentInfoGatherer gatherer) { File output = workDir.resolve(ENVIRONMENT_OUTPUT).toFile(); try (HtmlPage html = new HtmlPage(new PrintWriter( - new FileWriter(output, true)))) { + new FileWriter(output, true), true))) { try (ElapsedTimePrinter timePrinter = new ElapsedTimePrinter(new Stopwatch(), name, log)) { gatherer.gatherEnvironmentInfo(html.getRootSection()); diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java index 10c0580dc50..767e86648b8 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java @@ -70,9 +70,9 @@ public class GatherProcessInfoTimeoutHandler extends TimeoutHandler { String name = getClass().getName(); PrintWriter actionsLog; try { - // try to open a separate file for aciton log + // try to open a separate file for action log actionsLog = new PrintWriter(new FileWriter( - workDir.resolve(LOG_FILENAME).toFile(), true)); + workDir.resolve(LOG_FILENAME).toFile(), true), true); } catch (IOException e) { // use jtreg log as a fallback actionsLog = log; @@ -84,7 +84,7 @@ public class GatherProcessInfoTimeoutHandler extends TimeoutHandler { File output = workDir.resolve(OUTPUT_FILENAME).toFile(); try { - PrintWriter pw = new PrintWriter(new FileWriter(output, true)); + PrintWriter pw = new PrintWriter(new FileWriter(output, true), true); runGatherer(name, workDir, actionsLog, pw, pid); } catch (IOException e) { actionsLog.printf("IOException: cannot open output file[%s] : %s", From 6594e9ed4071f2267b75d6629317a7a27eedf404 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Mon, 24 Oct 2016 09:12:40 +0200 Subject: [PATCH 23/54] 8168414: Various timeouthandler fixes Reviewed-by: mlarsson --- test/failure_handler/Makefile | 3 +- .../failurehandler/action/ActionHelper.java | 40 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/test/failure_handler/Makefile b/test/failure_handler/Makefile index 49352cbc762..d8c71964bdc 100644 --- a/test/failure_handler/Makefile +++ b/test/failure_handler/Makefile @@ -86,7 +86,7 @@ classes: require_env test: require_env build rm -rf "${RUN_DIR}" mkdir -p "${RUN_DIR}" - "${JTREG_HOME}"/bin/jtreg \ + "${JTREG_HOME}"/bin/jtreg \ -jdk:"${JAVA_HOME}" \ ${JTREG_TEST_OPTS} \ -timeout:0.1 -va -retain:all \ @@ -94,6 +94,7 @@ test: require_env build -agentvm \ -thd:"${TARGET_JAR}" \ -th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \ + -thtimeout:0 \ -od:"${TARGET_JAR}" \ -o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \ -w:"${RUN_DIR}/JTwork" \ diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java index 6a8ae037ea4..8b2d2757ce7 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java @@ -164,7 +164,8 @@ public class ActionHelper { Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); - log.printf("%s%n[%tF % Date: Tue, 25 Oct 2016 14:49:48 +0300 Subject: [PATCH 24/54] 8165500: TestJpsJar shouldn't jar all test.classpath directories Refactor test to better handle errors Reviewed-by: sspitsyn --- test/lib/jdk/test/lib/apps/LingeredApp.java | 69 ++++++++++++++------- 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/test/lib/jdk/test/lib/apps/LingeredApp.java b/test/lib/jdk/test/lib/apps/LingeredApp.java index ac375b62faf..8632a835695 100644 --- a/test/lib/jdk/test/lib/apps/LingeredApp.java +++ b/test/lib/jdk/test/lib/apps/LingeredApp.java @@ -67,13 +67,14 @@ import java.util.UUID; public class LingeredApp { private static final long spinDelay = 1000; - private static final int appWaitTime = 100; - private final String lockFileName; private long lockCreationTime; - private Process appProcess; private final ArrayList storedAppOutput; + protected Process appProcess; + protected static final int appWaitTime = 100; + protected final String lockFileName; + /* * Drain child process output, store it into string array */ @@ -255,14 +256,10 @@ public class LingeredApp { } /** - * Run the app - * - * @param vmArguments - * @throws IOException + * Analyze an environment and prepare a command line to + * run the app, app name should be added explicitly */ - public void runApp(List vmArguments) - throws IOException { - + public List runAppPrepare(List vmArguments) { // We should always use testjava or throw an exception, // so we can't use JDKToolFinder.getJDKTool("java"); // that falls back to compile java on error @@ -303,28 +300,52 @@ public class LingeredApp { String classpath = System.getProperty("test.class.path"); cmd.add((classpath == null) ? "." : classpath); - cmd.add(this.getAppName()); - cmd.add(lockFileName); + return cmd; + } - // Reporting + /** + * Assemble command line to a printable string + */ + public void printCommandLine(List cmd) { + // A bit of verbosity StringBuilder cmdLine = new StringBuilder(); for (String strCmd : cmd) { cmdLine.append("'").append(strCmd).append("' "); } - // A bit of verbosity System.out.println("Command line: [" + cmdLine.toString() + "]"); + } + + public void startGobblerPipe() { + // Create pipe reader for process, and read stdin and stderr to array of strings + InputGobbler gb = new InputGobbler(appProcess.getInputStream(), storedAppOutput); + gb.start(); + } + + /** + * Run the app. + * + * @param vmArguments + * @throws IOException + */ + public void runApp(List vmArguments) + throws IOException { + + List cmd = runAppPrepare(vmArguments); + + cmd.add(this.getAppName()); + cmd.add(lockFileName); + + printCommandLine(cmd); ProcessBuilder pb = new ProcessBuilder(cmd); // we don't expect any error output but make sure we are not stuck on pipe // pb.redirectErrorStream(false); + // ProcessBuilder.start can throw IOException pb.redirectError(ProcessBuilder.Redirect.INHERIT); - appProcess = pb.start(); - // Create pipe reader for process, and read stdin and stderr to array of strings - InputGobbler gb = new InputGobbler(appProcess.getInputStream(), storedAppOutput); - gb.start(); + startGobblerPipe(); } /** @@ -334,10 +355,14 @@ public class LingeredApp { */ public void stopApp() throws IOException { deleteLock(); - waitAppTerminate(); - int exitcode = appProcess.exitValue(); - if (exitcode != 0) { - throw new IOException("LingeredApp terminated with non-zero exit code " + exitcode); + // The startApp() of the derived app can throw + // an exception before the LA actually starts + if (appProcess != null) { + waitAppTerminate(); + int exitcode = appProcess.exitValue(); + if (exitcode != 0) { + throw new IOException("LingeredApp terminated with non-zero exit code " + exitcode); + } } } From c8163c03882e542b410eee9096085e63dc630ddc Mon Sep 17 00:00:00 2001 From: Sergei Kovalev Date: Tue, 8 Nov 2016 16:18:41 +0300 Subject: [PATCH 25/54] 8169316: com/sun/net/httpserver tests have undeclared dependency on java.logging Reviewed-by: chegar --- jdk/test/com/sun/net/httpserver/TEST.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/com/sun/net/httpserver/TEST.properties b/jdk/test/com/sun/net/httpserver/TEST.properties index 4981030a154..45a2c1ca465 100644 --- a/jdk/test/com/sun/net/httpserver/TEST.properties +++ b/jdk/test/com/sun/net/httpserver/TEST.properties @@ -1 +1 @@ -modules = jdk.httpserver \ No newline at end of file +modules = jdk.httpserver java.logging From acae42fd30954875c5d0c1a4395715d0c3e4994c Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Tue, 8 Nov 2016 12:56:17 -0800 Subject: [PATCH 26/54] 8166379: IAE while invoking javadoc with --patch-module Reviewed-by: jjg --- .../jdk/javadoc/internal/tool/Start.java | 11 +++++++ .../jdk/javadoc/internal/tool/ToolOption.java | 33 +++++-------------- .../jdk/javadoc/tool/modules/Modules.java | 2 +- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java index c5b94f3500b..49cd9cdbff0 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java @@ -939,6 +939,17 @@ public class Start extends ToolOption.Helper { public void put(String name, String value) { compOpts.put(name, value); } + + @Override + public void remove(String name) { + compOpts.remove(name); + } + + @Override + public boolean handleFileManagerOption(com.sun.tools.javac.main.Option option, String value) { + fileManagerOpts.put(option, value); + return true; + } }; } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java index 1949e684dd9..7f4ef90868b 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java @@ -57,63 +57,56 @@ public enum ToolOption { BOOTCLASSPATH("-bootclasspath", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg); + Option.BOOT_CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg); } }, CLASS_PATH("--class-path -classpath -cp", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.CLASS_PATH, arg); + Option.CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg); } }, EXTDIRS("-extdirs", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.EXTDIRS, arg); + Option.EXTDIRS.process(helper.getOptionHelper(), primaryName, arg); } }, SOURCE_PATH("--source-path -sourcepath", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.SOURCE_PATH, arg); - } - }, - - SYSCLASSPATH("-sysclasspath", HIDDEN, true) { - @Override - public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg); + Option.SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg); } }, MODULE_SOURCE_PATH("--module-source-path", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg); + Option.MODULE_SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg); } }, UPGRADE_MODULE_PATH("--upgrade-module-path", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg); + Option.UPGRADE_MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg); } }, SYSTEM("--system", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.SYSTEM, arg); + Option.SYSTEM.process(helper.getOptionHelper(), primaryName, arg); } }, MODULE_PATH("--module-path -p", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.MODULE_PATH, arg); + Option.MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg); } }, @@ -141,7 +134,7 @@ public enum ToolOption { ENCODING("-encoding", STANDARD, true) { @Override public void process(Helper helper, String arg) { - helper.setFileManagerOpt(Option.ENCODING, arg); + Option.ENCODING.process(helper.getOptionHelper(), primaryName, arg); } }, @@ -290,14 +283,6 @@ public enum ToolOption { // ----- output control options ----- - PROMPT("-prompt", HIDDEN) { - @Override - public void process(Helper helper) { - helper.compOpts.put("-prompt", "-prompt"); - helper.promptOnError = true; - } - }, - QUIET("-quiet", STANDARD) { @Override public void process(Helper helper) { diff --git a/langtools/test/jdk/javadoc/tool/modules/Modules.java b/langtools/test/jdk/javadoc/tool/modules/Modules.java index 41114ea5806..39f94b666bf 100644 --- a/langtools/test/jdk/javadoc/tool/modules/Modules.java +++ b/langtools/test/jdk/javadoc/tool/modules/Modules.java @@ -296,7 +296,7 @@ public class Modules extends ModuleTestBase { checkMembersSelected("pkg2.B.f"); } -// @Test @ignore JDK-8166379 + @Test public void testPatchModuleOption(Path base) throws Exception { Path src = base.resolve("src"); Path modulePath = base.resolve("modules"); From b40c63e9fbf5bc1078bb867690c9d282a630a09b Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 10 Nov 2016 17:27:01 +0100 Subject: [PATCH 27/54] 8166700: NPE during invoking getEnclosedElements() on javax.lang.model.element.Element instance representing a package Should not strip first parameter of a local class constructor for local classes in initializers. Reviewed-by: jjg --- .../com/sun/tools/javac/code/Scope.java | 8 +- .../com/sun/tools/javac/jvm/ClassReader.java | 7 +- .../model/LocalClasses/LocalClassesModel.java | 73 ++++++++ .../model/LocalClasses/LocalClassesModel.out | 12 ++ .../model/LocalClasses/LocalTest$1Local.jcod | 77 +++++++++ .../model/LocalClasses/LocalTest$2Local.jcod | 90 ++++++++++ .../model/LocalClasses/LocalTest$3Local.jcod | 79 +++++++++ .../model/LocalClasses/LocalTest$4Local.jcod | 92 ++++++++++ .../model/LocalClasses/LocalTest$5Local.jcod | 90 ++++++++++ .../model/LocalClasses/LocalTest.jcod | 160 ++++++++++++++++++ .../model/LocalClasses/LocalTest.orign | 43 +++++ 11 files changed, 729 insertions(+), 2 deletions(-) create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.out create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$1Local.jcod create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$2Local.jcod create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$3Local.jcod create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$4Local.jcod create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$5Local.jcod create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.jcod create mode 100644 langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.orign diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java index fbdb07ef248..5b7d30c80b0 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java @@ -137,12 +137,18 @@ public abstract class Scope { /** Returns true iff the given Symbol is in this scope or any outward scope. */ public boolean includes(final Symbol sym) { + return includes(sym, RECURSIVE); + } + + /** Returns true iff the given Symbol is in this scope, optionally checking outward scopes. + */ + public boolean includes(final Symbol sym, LookupKind lookupKind) { return getSymbolsByName(sym.name, new Filter() { @Override public boolean accepts(Symbol t) { return t == sym; } - }).iterator().hasNext(); + }, lookupKind).iterator().hasNext(); } /** Returns true iff this scope does not contain any Symbol. Does not inspect outward scopes. diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java index c1e0964aaef..1416d2b8b9b 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -62,6 +62,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Kinds.Kind.*; +import com.sun.tools.javac.code.Scope.LookupKind; import static com.sun.tools.javac.code.TypeTag.ARRAY; import static com.sun.tools.javac.code.TypeTag.CLASS; import static com.sun.tools.javac.code.TypeTag.TYPEVAR; @@ -2186,7 +2187,11 @@ public class ClassReader { // Sometimes anonymous classes don't have an outer // instance, however, there is no reliable way to tell so // we never strip this$n - if (!currentOwner.name.isEmpty()) + // ditto for local classes. Local classes that have an enclosing method set + // won't pass the "hasOuterInstance" check above, but those that don't have an + // enclosing method (i.e. from initializers) will pass that check. + boolean local = !currentOwner.owner.members().includes(currentOwner, LookupKind.NON_RECURSIVE); + if (!currentOwner.name.isEmpty() && !local) type = new MethodType(adjustMethodParams(flags, type.getParameterTypes()), type.getReturnType(), type.getThrownTypes(), diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java b/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java new file mode 100644 index 00000000000..9f8a3977305 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016, 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 8166700 + * @summary Check that local classes originating in static initializer can be loaded properly. + * @modules jdk.compiler + * @build LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest + * @compile LocalClassesModel.java + * @compile/process/ref=LocalClassesModel.out -processor LocalClassesModel LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest + */ + +import java.util.Set; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.util.ElementFilter; + +@SupportedAnnotationTypes("*") +public class LocalClassesModel extends AbstractProcessor { + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + for (TypeElement root : ElementFilter.typesIn(roundEnv.getRootElements())) { + System.out.println(processingEnv.getElementUtils().getBinaryName(root)); + for (ExecutableElement constr : ElementFilter.constructorsIn(root.getEnclosedElements())) { + System.out.print(" ("); + boolean first = true; + for (VariableElement param : constr.getParameters()) { + if (!first) { + System.out.print(", "); + } + first = false; + System.out.print(param.asType().toString()); + } + System.out.println(")"); + } + } + + return false; + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latestSupported(); + } +} \ No newline at end of file diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.out b/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.out new file mode 100644 index 00000000000..895193116f3 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.out @@ -0,0 +1,12 @@ +LocalTest$1Local + () +LocalTest$2Local + (LocalTest) +LocalTest$3Local + () +LocalTest$4Local + (LocalTest) +LocalTest$5Local + (LocalTest) +LocalTest + () diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$1Local.jcod b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$1Local.jcod new file mode 100644 index 00000000000..3ffaeecee84 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$1Local.jcod @@ -0,0 +1,77 @@ +class LocalTest$1Local { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #12; // #1 + class #13; // #2 + class #16; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "LineNumberTable"; // #7 + Utf8 "SourceFile"; // #8 + Utf8 "LocalTest.java"; // #9 + Utf8 "EnclosingMethod"; // #10 + class #17; // #11 + NameAndType #4 #5; // #12 + Utf8 "LocalTest$1Local"; // #13 + Utf8 "Local"; // #14 + Utf8 "InnerClasses"; // #15 + Utf8 "java/lang/Object"; // #16 + Utf8 "LocalTest"; // #17 + } // Constant Pool + + 0x0020; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0000; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#7) { // LineNumberTable + [] { // LineNumberTable + 0 3; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#8) { // SourceFile + #9; + } // end SourceFile + ; + Attr(#10) { // EnclosingMethod + #11 #0; + } // end EnclosingMethod + ; + Attr(#15) { // InnerClasses + [] { // InnerClasses + #2 #0 #14 0; + } + } // end InnerClasses + } // Attributes +} // end class LocalTest$1Local diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$2Local.jcod b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$2Local.jcod new file mode 100644 index 00000000000..23808b81b1b --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$2Local.jcod @@ -0,0 +1,90 @@ +class LocalTest$2Local { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Field #3 #15; // #1 + Method #4 #16; // #2 + class #17; // #3 + class #20; // #4 + Utf8 "this$0"; // #5 + Utf8 "LLocalTest;"; // #6 + Utf8 ""; // #7 + Utf8 "(LLocalTest;)V"; // #8 + Utf8 "Code"; // #9 + Utf8 "LineNumberTable"; // #10 + Utf8 "SourceFile"; // #11 + Utf8 "LocalTest.java"; // #12 + Utf8 "EnclosingMethod"; // #13 + class #21; // #14 + NameAndType #5 #6; // #15 + NameAndType #7 #22; // #16 + Utf8 "LocalTest$2Local"; // #17 + Utf8 "Local"; // #18 + Utf8 "InnerClasses"; // #19 + Utf8 "java/lang/Object"; // #20 + Utf8 "LocalTest"; // #21 + Utf8 "()V"; // #22 + } // Constant Pool + + 0x0020; // access + #3;// this_cpx + #4;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + { // Member + 0x1010; // access + #5; // name_cpx + #6; // sig_cpx + [] { // Attributes + } // Attributes + } // Member + } // fields + + [] { // methods + { // Member + 0x0000; // access + #7; // name_cpx + #8; // sig_cpx + [] { // Attributes + Attr(#9) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB500012AB700; + 0x02B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#10) { // LineNumberTable + [] { // LineNumberTable + 0 6; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#11) { // SourceFile + #12; + } // end SourceFile + ; + Attr(#13) { // EnclosingMethod + #14 #0; + } // end EnclosingMethod + ; + Attr(#19) { // InnerClasses + [] { // InnerClasses + #3 #0 #18 0; + } + } // end InnerClasses + } // Attributes +} // end class LocalTest$2Local diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$3Local.jcod b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$3Local.jcod new file mode 100644 index 00000000000..fd7d2681f2e --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$3Local.jcod @@ -0,0 +1,79 @@ +class LocalTest$3Local { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #13; // #1 + class #14; // #2 + class #17; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "LineNumberTable"; // #7 + Utf8 "SourceFile"; // #8 + Utf8 "LocalTest.java"; // #9 + Utf8 "EnclosingMethod"; // #10 + class #18; // #11 + NameAndType #19 #5; // #12 + NameAndType #4 #5; // #13 + Utf8 "LocalTest$3Local"; // #14 + Utf8 "Local"; // #15 + Utf8 "InnerClasses"; // #16 + Utf8 "java/lang/Object"; // #17 + Utf8 "LocalTest"; // #18 + Utf8 "test1"; // #19 + } // Constant Pool + + 0x0020; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0000; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#7) { // LineNumberTable + [] { // LineNumberTable + 0 9; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#8) { // SourceFile + #9; + } // end SourceFile + ; + Attr(#10) { // EnclosingMethod + #11 #12; + } // end EnclosingMethod + ; + Attr(#16) { // InnerClasses + [] { // InnerClasses + #2 #0 #15 0; + } + } // end InnerClasses + } // Attributes +} // end class LocalTest$3Local diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$4Local.jcod b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$4Local.jcod new file mode 100644 index 00000000000..737dcb43c82 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$4Local.jcod @@ -0,0 +1,92 @@ +class LocalTest$4Local { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Field #3 #16; // #1 + Method #4 #17; // #2 + class #18; // #3 + class #21; // #4 + Utf8 "this$0"; // #5 + Utf8 "LLocalTest;"; // #6 + Utf8 ""; // #7 + Utf8 "(LLocalTest;)V"; // #8 + Utf8 "Code"; // #9 + Utf8 "LineNumberTable"; // #10 + Utf8 "SourceFile"; // #11 + Utf8 "LocalTest.java"; // #12 + Utf8 "EnclosingMethod"; // #13 + class #22; // #14 + NameAndType #23 #24; // #15 + NameAndType #5 #6; // #16 + NameAndType #7 #24; // #17 + Utf8 "LocalTest$4Local"; // #18 + Utf8 "Local"; // #19 + Utf8 "InnerClasses"; // #20 + Utf8 "java/lang/Object"; // #21 + Utf8 "LocalTest"; // #22 + Utf8 "test2"; // #23 + Utf8 "()V"; // #24 + } // Constant Pool + + 0x0020; // access + #3;// this_cpx + #4;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + { // Member + 0x1010; // access + #5; // name_cpx + #6; // sig_cpx + [] { // Attributes + } // Attributes + } // Member + } // fields + + [] { // methods + { // Member + 0x0000; // access + #7; // name_cpx + #8; // sig_cpx + [] { // Attributes + Attr(#9) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB500012AB700; + 0x02B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#10) { // LineNumberTable + [] { // LineNumberTable + 0 12; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#11) { // SourceFile + #12; + } // end SourceFile + ; + Attr(#13) { // EnclosingMethod + #14 #15; + } // end EnclosingMethod + ; + Attr(#20) { // InnerClasses + [] { // InnerClasses + #3 #0 #19 0; + } + } // end InnerClasses + } // Attributes +} // end class LocalTest$4Local diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$5Local.jcod b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$5Local.jcod new file mode 100644 index 00000000000..f377dbec956 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest$5Local.jcod @@ -0,0 +1,90 @@ +class LocalTest$5Local { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Field #3 #16; // #1 + Method #4 #15; // #2 + class #17; // #3 + class #20; // #4 + Utf8 "this$0"; // #5 + Utf8 "LLocalTest;"; // #6 + Utf8 ""; // #7 + Utf8 "(LLocalTest;)V"; // #8 + Utf8 "Code"; // #9 + Utf8 "LineNumberTable"; // #10 + Utf8 "SourceFile"; // #11 + Utf8 "LocalTest.java"; // #12 + Utf8 "EnclosingMethod"; // #13 + class #21; // #14 + NameAndType #7 #22; // #15 + NameAndType #5 #6; // #16 + Utf8 "LocalTest$5Local"; // #17 + Utf8 "Local"; // #18 + Utf8 "InnerClasses"; // #19 + Utf8 "java/lang/Object"; // #20 + Utf8 "LocalTest"; // #21 + Utf8 "()V"; // #22 + } // Constant Pool + + 0x0020; // access + #3;// this_cpx + #4;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + { // Member + 0x1010; // access + #5; // name_cpx + #6; // sig_cpx + [] { // Attributes + } // Attributes + } // Member + } // fields + + [] { // methods + { // Member + 0x0000; // access + #7; // name_cpx + #8; // sig_cpx + [] { // Attributes + Attr(#9) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB500012AB700; + 0x02B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#10) { // LineNumberTable + [] { // LineNumberTable + 0 15; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#11) { // SourceFile + #12; + } // end SourceFile + ; + Attr(#13) { // EnclosingMethod + #14 #15; + } // end EnclosingMethod + ; + Attr(#19) { // InnerClasses + [] { // InnerClasses + #3 #0 #18 0; + } + } // end InnerClasses + } // Attributes +} // end class LocalTest$5Local diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.jcod b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.jcod new file mode 100644 index 00000000000..7bde5b0329b --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.jcod @@ -0,0 +1,160 @@ +class LocalTest { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #20; // #1 + class #21; // #2 + class #22; // #3 + class #23; // #4 + Utf8 "Local"; // #5 + Utf8 "InnerClasses"; // #6 + class #24; // #7 + class #25; // #8 + class #26; // #9 + class #27; // #10 + Utf8 "test1"; // #11 + Utf8 "()V"; // #12 + Utf8 "Code"; // #13 + Utf8 "LineNumberTable"; // #14 + Utf8 "test2"; // #15 + Utf8 ""; // #16 + Utf8 ""; // #17 + Utf8 "SourceFile"; // #18 + Utf8 "LocalTest.java"; // #19 + NameAndType #16 #12; // #20 + Utf8 "LocalTest"; // #21 + Utf8 "java/lang/Object"; // #22 + Utf8 "LocalTest$5Local"; // #23 + Utf8 "LocalTest$4Local"; // #24 + Utf8 "LocalTest$3Local"; // #25 + Utf8 "LocalTest$2Local"; // #26 + Utf8 "LocalTest$1Local"; // #27 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0008; // access + #11; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 0; // max_stack + 0; // max_locals + Bytes[]{ + 0xB1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#14) { // LineNumberTable + [] { // LineNumberTable + 0 10; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0000; // access + #15; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 0; // max_stack + 1; // max_locals + Bytes[]{ + 0xB1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#14) { // LineNumberTable + [] { // LineNumberTable + 0 13; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0000; // access + #16; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#14) { // LineNumberTable + [] { // LineNumberTable + 0 14; + 4 16; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0008; // access + #17; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 0; // max_stack + 0; // max_locals + Bytes[]{ + 0xB1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#14) { // LineNumberTable + [] { // LineNumberTable + 0 4; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#18) { // SourceFile + #19; + } // end SourceFile + ; + Attr(#6) { // InnerClasses + [] { // InnerClasses + #4 #0 #5 0; + #7 #0 #5 0; + #8 #0 #5 0; + #9 #0 #5 0; + #10 #0 #5 0; + } + } // end InnerClasses + } // Attributes +} // end class LocalTest diff --git a/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.orign b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.orign new file mode 100644 index 00000000000..7f56f2e4e68 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalTest.orign @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016, 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. + */ + +/**The jcod files are generated from this file, compiled by JDK 8 javac. + */ +public class LocalTest { + static { + class Local { } + } + { + class Local { } + } + static void test1() { + class Local { } + } + void test2() { + class Local { } + } + LocalTest() { + class Local { } + } +} + From a1f6786ab948034e773c94ddc68f3a5f4ee43c04 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 10 Nov 2016 13:29:34 -0800 Subject: [PATCH 28/54] 8169447: javac should detect/reject repeated use of --patch-module on command line Reviewed-by: jlahoda --- .../com/sun/tools/javac/main/Option.java | 54 +++++++++++-------- .../tools/javac/resources/javac.properties | 2 + .../tools/javac/modules/PatchModulesTest.java | 31 ++++++++++- 3 files changed, 62 insertions(+), 25 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java index 756b0080bc2..7dd835f82fb 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java @@ -35,6 +35,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.EnumSet; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -43,6 +44,7 @@ import java.util.Map; import java.util.ServiceLoader; import java.util.Set; import java.util.TreeSet; +import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.StreamSupport; @@ -200,31 +202,37 @@ public enum Option { // The standard file manager code knows to split apart the NULL-separated components. @Override public boolean process(OptionHelper helper, String option, String arg) { - if (!arg.contains("=")) { // could be more strict regeex, e.g. "(?i)[a-z0-9_.]+=.*" - helper.error(Errors.LocnInvalidArgForXpatch(arg)); + if (arg.isEmpty()) { + helper.error("err.no.value.for.option", option); + return true; + } else if (getPattern().matcher(arg).matches()) { + String prev = helper.get(PATCH_MODULE); + if (prev == null) { + super.process(helper, option, arg); + return false; + } else { + String argModulePackage = arg.substring(0, arg.indexOf('=')); + boolean isRepeated = Arrays.stream(prev.split("\0")) + .map(s -> s.substring(0, s.indexOf('='))) + .collect(Collectors.toSet()) + .contains(argModulePackage); + if (isRepeated) { + helper.error("err.repeated.value.for.patch.module", argModulePackage); + return true; + } else { + super.process(helper, option, prev + '\0' + arg); + return false; + } + } + } else { + helper.error("err.bad.value.for.option", option, arg); + return true; } + } - String previous = helper.get(this); - if (previous == null) { - return super.process(helper, option, arg); - } - - Map map = new LinkedHashMap<>(); - for (String s : previous.split("\0")) { - int sep = s.indexOf('='); - map.put(s.substring(0, sep), s.substring(sep + 1)); - } - - int sep = arg.indexOf('='); - map.put(arg.substring(0, sep), arg.substring(sep + 1)); - - StringBuilder sb = new StringBuilder(); - map.forEach((m, p) -> { - if (sb.length() > 0) - sb.append('\0'); - sb.append(m).append('=').append(p); - }); - return super.process(helper, option, sb.toString()); + @Override + public Pattern getPattern() { + return Pattern.compile("([^/]+)=(,*[^,].*)"); } }, diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties index faa6db19881..6acb5db137d 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties @@ -361,6 +361,8 @@ javac.err.bad.value.for.option=\ bad value for {0} option: ''{1}'' javac.err.no.value.for.option=\ no value for {0} option +javac.err.repeated.value.for.patch.module=\ + --patch-module specified more than once for {0} ## messages diff --git a/langtools/test/tools/javac/modules/PatchModulesTest.java b/langtools/test/tools/javac/modules/PatchModulesTest.java index bf481c596e4..648ba4901ac 100644 --- a/langtools/test/tools/javac/modules/PatchModulesTest.java +++ b/langtools/test/tools/javac/modules/PatchModulesTest.java @@ -91,12 +91,28 @@ public class PatchModulesTest extends ModuleTestBase { } @Test - public void testLastOneWins(Path base) throws Exception { + public void testDuplicates(Path base) throws Exception { test(asList("java.base=a", "java.compiler=b", "java.base=c"), - "{java.base=[c], java.compiler=[b]}"); + false, "--patch-module specified more than once for java.base"); + } + + @Test + public void testEmpty(Path base) throws Exception { + test(asList(""), + false, "no value for --patch-module option"); + } + + @Test + public void testInvalid(Path base) throws Exception { + test(asList("java.base/java.lang=."), + false, "bad value for --patch-module option: 'java.base/java.lang=.'"); } void test(List patches, String expect) throws Exception { + test(patches, true, expect); + } + + void test(List patches, boolean expectOK, String expect) throws Exception { JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler(); StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { @@ -116,6 +132,17 @@ public class PatchModulesTest extends ModuleTestBase { Map patchMap = (Map) patchMapField.get(locations); String found = patchMap.toString(); + if (!found.equals(expect)) { + tb.out.println("Expect: " + expect); + tb.out.println("Found: " + found); + error("output not as expected"); + } + } catch (IllegalArgumentException e) { + if (expectOK) { + error("unexpected exception: " + e); + throw e; + } + String found = e.getMessage(); if (!found.equals(expect)) { tb.out.println("Expect: " + expect); tb.out.println("Found: " + found); From 41b6425f104b75f88fe6c0180fdf9b579b2dd211 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Fri, 11 Nov 2016 05:11:52 +0000 Subject: [PATCH 29/54] Added tag jdk-9+144 for changeset 458b7becdccc --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 4ff5566b655..5ab3bfa0769 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -546,3 +546,4 @@ fec31089c2ef5a12dd64f401b0bf2e00f56ee0d0 jdk-9+140 160a00bc6ed0af1fdf8418fc65e6bddbbc0c536d jdk-9+141 7b48d63dfd6b8e2657288de3d7b1f153dee02d7e jdk-9+142 d87d5d430c42342f0320ca7f5cbe0cbd1f9d62ba jdk-9+143 +6187b582d02aee38341dc8ce4011906e9b364e9f jdk-9+144 From 40afef20ba5d22fc4cbb135b25317554c84bae77 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Fri, 11 Nov 2016 05:11:52 +0000 Subject: [PATCH 30/54] Added tag jdk-9+144 for changeset 4a00f20b9fe2 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index c96fdd40202..7ec4e1bd79d 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -386,3 +386,4 @@ aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136 b32f998da32b488ec7c4e9dbb3c750841b48e74d jdk-9+141 408c9c621938ca028e20bced0459f815de47eba8 jdk-9+142 6211236ef15ec796806357608b1dd1b70c258ece jdk-9+143 +d4f1dae174098e799c48948e866054c52e11a186 jdk-9+144 From 0e992818640a37060549af6290b9c1212b0c2a39 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Fri, 11 Nov 2016 05:11:53 +0000 Subject: [PATCH 31/54] Added tag jdk-9+144 for changeset 773cd6c4b8e7 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index addee1762c9..900943ec381 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -386,3 +386,4 @@ a8d5fe567ae72b4931040e59dd4478363f9004f5 jdk-9+137 037c095ba0c345edbeaaab52fda913a76c3930c0 jdk-9+141 bdafa0cc34a97a2f8db4847a4efd34b407943591 jdk-9+142 ce81d03ad7320dca3d673374c1a33bc0efd9136a jdk-9+143 +99be33734ff62b75116b1202d49a4d4e1bda4226 jdk-9+144 From 609ef5def3db7f7954282a8bb3a45b3dfe444af7 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Fri, 11 Nov 2016 05:11:53 +0000 Subject: [PATCH 32/54] Added tag jdk-9+144 for changeset f692ed885b0c --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 790219ed5e4..5d90ddab9df 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -389,3 +389,4 @@ ab1d78d395d4cb8be426ff181211da1a4085cf01 jdk-9+134 b2c18f755228d1d19a86cd7d5fa1abb6b1495dfb jdk-9+141 59101416d90160cfcb4f45dfbccaec15e2c27a29 jdk-9+142 1c988e708a06257119d54d8a57e99e3b0f37ff18 jdk-9+143 +92523c51d6a48b0a83912ba3cc43bc57b8159c2a jdk-9+144 From 26da3a9538f84616fdcc98f3857d12c6b65461fd Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Fri, 11 Nov 2016 05:11:55 +0000 Subject: [PATCH 33/54] Added tag jdk-9+144 for changeset a4ee110842fb --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index cafeca2beaf..4205f71b3ec 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -386,3 +386,4 @@ dd56c243c199a540c9f1fbff4855f0934b32a9d0 jdk-9+137 296c875051187918f8f3f87e9432036d13013d39 jdk-9+141 d245e56f4a79a8a8d18bd143c08f079ee98ab638 jdk-9+142 6ef8a1453577832626b0efb7f70a3102b721ebbf jdk-9+143 +47871e348144bafddea0ede3a44299461e254a2d jdk-9+144 From 5f91733e003457e5e98328c4eb16264e4d8b473f Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Fri, 11 Nov 2016 05:11:55 +0000 Subject: [PATCH 34/54] Added tag jdk-9+144 for changeset d55f24e8953e --- nashorn/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/nashorn/.hgtags b/nashorn/.hgtags index edcfefd25c1..fc07f2de0a9 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -377,3 +377,4 @@ e3b11296395b39bfeb3364f26c2ef77fa652e300 jdk-9+139 a46b7d3867957a868a6cc8ee66c05079b883733a jdk-9+141 d3f5d7311a1aec3152b17d75046d5d298245a0b4 jdk-9+142 b4e57ead3fae4939b70dd345d1f6744a1dedfa21 jdk-9+143 +a7f21ee6ed30695a6de14e74035d2857a754f62b jdk-9+144 From d969a1a3fa9ea2242694c3e238c23a1454e2d1f4 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Fri, 11 Nov 2016 12:54:47 +0100 Subject: [PATCH 35/54] 8145838: JShell: restrict RemoteAgent connection socket to localhost Also reviewed by Chris Ries Reviewed-by: rfield --- .../execution/JdiDefaultExecutionControl.java | 43 ++++++++++++++++++- .../execution/RemoteExecutionControl.java | 21 +++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java index 45114ac03a6..8e22d330e82 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java @@ -24,18 +24,23 @@ */ package jdk.jshell.execution; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.OutputStream; +import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; +import java.security.SecureRandom; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Consumer; + import com.sun.jdi.BooleanValue; import com.sun.jdi.ClassNotLoadedException; import com.sun.jdi.Field; @@ -111,7 +116,7 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl { */ private static ExecutionControl create(ExecutionEnv env, boolean isLaunch, String host) throws IOException { - try (final ServerSocket listener = new ServerSocket(0)) { + try (final ServerSocket listener = new ServerSocket(0, 1, InetAddress.getLoopbackAddress())) { // timeout after 60 seconds listener.setSoTimeout(60000); int port = listener.getLocalPort(); @@ -122,6 +127,14 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl { VirtualMachine vm = jdii.vm(); Process process = jdii.process(); + OutputStream processOut = process.getOutputStream(); + SecureRandom rng = new SecureRandom(); + byte[] randomBytes = new byte[VERIFY_HASH_LEN]; + + rng.nextBytes(randomBytes); + processOut.write(randomBytes); + processOut.flush(); + List> deathListeners = new ArrayList<>(); deathListeners.add(s -> env.closeDown()); Util.detectJdiExitEvent(vm, s -> { @@ -130,6 +143,8 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl { } }); + ByteArrayOutputStream receivedRandomBytes = new ByteArrayOutputStream(); + // Set-up the commands/reslts on the socket. Piggy-back snippet // output. Socket socket = listener.accept(); @@ -138,11 +153,35 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl { Map outputs = new HashMap<>(); outputs.put("out", env.userOut()); outputs.put("err", env.userErr()); + outputs.put("echo", new OutputStream() { + @Override public void write(int b) throws IOException { + synchronized (receivedRandomBytes) { + receivedRandomBytes.write(b); + receivedRandomBytes.notify(); + } + } + }); Map input = new HashMap<>(); input.put("in", env.userIn()); - return remoteInputOutput(socket.getInputStream(), out, outputs, input, (objIn, objOut) -> new JdiDefaultExecutionControl(objOut, objIn, vm, process, deathListeners)); + return remoteInputOutput(socket.getInputStream(), out, outputs, input, (objIn, objOut) -> { + synchronized (receivedRandomBytes) { + while (receivedRandomBytes.size() < randomBytes.length) { + try { + receivedRandomBytes.wait(); + } catch (InterruptedException ex) { + //ignore + } + } + if (!Arrays.equals(receivedRandomBytes.toByteArray(), randomBytes)) { + throw new IllegalStateException("Invalid connection!"); + } + } + return new JdiDefaultExecutionControl(objOut, objIn, vm, process, deathListeners); + }); } } + //where: + private static final int VERIFY_HASH_LEN = 20; /** * Create an instance. diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java index 81eac159b60..32330239d1f 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java @@ -24,6 +24,7 @@ */ package jdk.jshell.execution; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; @@ -57,6 +58,7 @@ public class RemoteExecutionControl extends DirectExecutionControl implements Ex * @throws Exception any unexpected exception */ public static void main(String[] args) throws Exception { + InputStream fd0 = System.in; String loopBack = null; Socket socket = new Socket(loopBack, Integer.parseInt(args[0])); InputStream inStream = socket.getInputStream(); @@ -64,6 +66,25 @@ public class RemoteExecutionControl extends DirectExecutionControl implements Ex Map> outputs = new HashMap<>(); outputs.put("out", st -> System.setOut(new PrintStream(st, true))); outputs.put("err", st -> System.setErr(new PrintStream(st, true))); + outputs.put("echo", st -> { + new Thread(() -> { + try { + int read; + + while ((read = fd0.read()) != (-1)) { + st.write(read); + } + } catch (IOException ex) { + ex.printStackTrace(); + } finally { + try { + st.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + }).start(); + }); Map> input = new HashMap<>(); input.put("in", st -> System.setIn(st)); forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, outputs, input); From 1406cd4347fe1359338945dd5d87141b86efbfd1 Mon Sep 17 00:00:00 2001 From: Attila Szegedi Date: Fri, 11 Nov 2016 15:50:51 +0100 Subject: [PATCH 36/54] 8168373: don't emit conversions for symbols outside their lexical scope Reviewed-by: hannesw, sundar --- .../codegen/LocalVariableTypesCalculator.java | 79 +++++++++++++------ .../internal/ir/debug/PrintVisitor.java | 2 +- nashorn/test/script/basic/es6/JDK-8168373.js | 44 +++++++++++ 3 files changed, 98 insertions(+), 27 deletions(-) create mode 100644 nashorn/test/script/basic/es6/JDK-8168373.js diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java index cf92047730c..8b34bfc9ef8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java @@ -33,6 +33,7 @@ import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; import java.util.Deque; +import java.util.HashMap; import java.util.HashSet; import java.util.IdentityHashMap; import java.util.Iterator; @@ -122,9 +123,9 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { private final List origins = new LinkedList<>(); private Map types = Collections.emptyMap(); - void addOrigin(final JoinPredecessor originNode, final Map originTypes) { + void addOrigin(final JoinPredecessor originNode, final Map originTypes, final LocalVariableTypesCalculator calc) { origins.add(new JumpOrigin(originNode, originTypes)); - this.types = getUnionTypes(this.types, originTypes); + this.types = calc.getUnionTypes(this.types, originTypes); } } private enum LvarType { @@ -185,12 +186,15 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { } @SuppressWarnings("unchecked") - private static IdentityHashMap cloneMap(final Map map) { - return (IdentityHashMap)((IdentityHashMap)map).clone(); + private static HashMap cloneMap(final Map map) { + return (HashMap)((HashMap)map).clone(); } private LocalVariableConversion createConversion(final Symbol symbol, final LvarType branchLvarType, final Map joinLvarTypes, final LocalVariableConversion next) { + if (invalidatedSymbols.contains(symbol)) { + return next; + } final LvarType targetType = joinLvarTypes.get(symbol); assert targetType != null; if(targetType == branchLvarType) { @@ -208,7 +212,7 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { return new LocalVariableConversion(symbol, branchLvarType.type, targetType.type, next); } - private static Map getUnionTypes(final Map types1, final Map types2) { + private Map getUnionTypes(final Map types1, final Map types2) { if(types1 == types2 || types1.isEmpty()) { return types2; } else if(types2.isEmpty()) { @@ -261,6 +265,11 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { final LvarType type2 = types2.get(symbol); union.put(symbol, widestLvarType(type1, type2)); } + // If the two sets of symbols differ, there's a good chance that some of + // symbols only appearing in one of the sets are lexically invalidated, + // so we remove them from further consideration. + // This is not strictly necessary, just a working set size optimization. + union.keySet().removeAll(invalidatedSymbols); return union; } @@ -359,8 +368,6 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { if(t1.ordinal() < LvarType.INT.ordinal() || t2.ordinal() < LvarType.INT.ordinal()) { return LvarType.OBJECT; } - // NOTE: we allow "widening" of long to double even though it can lose precision. ECMAScript doesn't have an - // Int64 type anyway, so this loss of precision is actually more conformant to the specification... return LvarType.values()[Math.max(t1.ordinal(), t2.ordinal())]; } private final Compiler compiler; @@ -368,7 +375,10 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { // Local variable type mapping at the currently evaluated point. No map instance is ever modified; setLvarType() always // allocates a new map. Immutability of maps allows for cheap snapshots by just keeping the reference to the current // value. - private Map localVariableTypes = new IdentityHashMap<>(); + private Map localVariableTypes = Collections.emptyMap(); + // Set of symbols whose lexical scope has already ended. + private final Set invalidatedSymbols = new HashSet<>(); + // Stack for evaluated expression types. private final Deque typeStack = new ArrayDeque<>(); @@ -464,9 +474,19 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { @Override public boolean enterBlock(final Block block) { + boolean cloned = false; for(final Symbol symbol: block.getSymbols()) { - if(symbol.isBytecodeLocal() && getLocalVariableTypeOrNull(symbol) == null) { - setType(symbol, LvarType.UNDEFINED); + if(symbol.isBytecodeLocal()) { + if (getLocalVariableTypeOrNull(symbol) == null) { + if (!cloned) { + cloneOrNewLocalVariableTypes(); + cloned = true; + } + localVariableTypes.put(symbol, LvarType.UNDEFINED); + } + // In case we're repeating analysis of a lexical scope (e.g. it's in a loop), + // make sure all symbols lexically scoped by the block become valid again. + invalidatedSymbols.remove(symbol); } } return true; @@ -1046,15 +1066,11 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { // throw an exception. reachable = true; catchBody.accept(this); - final Symbol exceptionSymbol = exception.getSymbol(); if(reachable) { - localVariableTypes = cloneMap(localVariableTypes); - localVariableTypes.remove(exceptionSymbol); jumpToLabel(catchBody, endLabel); canExit = true; } - localVariableTypes = cloneMap(afterConditionTypes); - localVariableTypes.remove(exceptionSymbol); + localVariableTypes = afterConditionTypes; } // NOTE: if we had one or more conditional catch blocks with no unconditional catch block following them, then // there will be an unconditional rethrow, so the join point can never be reached from the last @@ -1204,7 +1220,7 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { } private void jumpToLabel(final JoinPredecessor jumpOrigin, final Label label, final Map types) { - getOrCreateJumpTarget(label).addOrigin(jumpOrigin, types); + getOrCreateJumpTarget(label).addOrigin(jumpOrigin, types, this); } @Override @@ -1226,16 +1242,18 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { boolean cloned = false; for(final Symbol symbol: block.getSymbols()) { - // Undefine the symbol outside the block - if(localVariableTypes.containsKey(symbol)) { - if(!cloned) { - localVariableTypes = cloneMap(localVariableTypes); - cloned = true; - } - localVariableTypes.remove(symbol); - } - if(symbol.hasSlot()) { + // Invalidate the symbol when its defining block ends + if (symbol.isBytecodeLocal()) { + if(localVariableTypes.containsKey(symbol)) { + if(!cloned) { + localVariableTypes = cloneMap(localVariableTypes); + cloned = true; + } + } + invalidateSymbol(symbol); + } + final SymbolConversions conversions = symbolConversions.get(symbol); if(conversions != null) { // Potentially make some currently dead types live if they're needed as a source of a type @@ -1605,10 +1623,19 @@ final class LocalVariableTypesCalculator extends SimpleNodeVisitor { } assert symbol.hasSlot(); assert !symbol.isGlobal(); - localVariableTypes = localVariableTypes.isEmpty() ? new IdentityHashMap() : cloneMap(localVariableTypes); + cloneOrNewLocalVariableTypes(); localVariableTypes.put(symbol, type); } + private void cloneOrNewLocalVariableTypes() { + localVariableTypes = localVariableTypes.isEmpty() ? new HashMap() : cloneMap(localVariableTypes); + } + + private void invalidateSymbol(final Symbol symbol) { + localVariableTypes.remove(symbol); + invalidatedSymbols.add(symbol); + } + /** * Set a flag in the symbol marking it as needing to be able to store a value of a particular type. Every symbol for * a local variable will be assigned between 1 and 6 local variable slots for storing all types it is known to need diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/PrintVisitor.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/PrintVisitor.java index bb8d61a5907..fccad1532aa 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/PrintVisitor.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/PrintVisitor.java @@ -397,7 +397,7 @@ public final class PrintVisitor extends SimpleNodeVisitor { @Override public boolean enterVarNode(final VarNode varNode) { - sb.append("var "); + sb.append(varNode.isConst() ? "const " : varNode.isLet() ? "let " : "var "); varNode.getName().toString(sb, printTypes); printLocalVariableConversion(varNode.getName()); final Node init = varNode.getInit(); diff --git a/nashorn/test/script/basic/es6/JDK-8168373.js b/nashorn/test/script/basic/es6/JDK-8168373.js new file mode 100644 index 00000000000..af26e73533e --- /dev/null +++ b/nashorn/test/script/basic/es6/JDK-8168373.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 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-8168373: don't emit conversions for symbols outside their lexical scope + * + * @test + * @run + * @option --language=es6 + */ + +function p() { return false } // "predicate" +function r(x) { return x } // "read" + +(function() { + try { // Try creates control flow edges from assignments into catch blocks. + // Lexically scoped, never read int variable (undefined at catch block) but still with a cf edge into catch block. + // Since it's never read, it's not written either (Nashorn optimizes some dead writes). + let x = 0; + if (p()) { throw {}; } // We need `p()` so this block doesn't get optimized away, for possibility of a `throw` + x = 0.0; // change the type of x to double + r(x); // read x otherwise it's optimized away + } catch (e) {} // under the bug, "throw" will try to widen unwritten int x to double for here and cause a verifier error +})() From 4ca0a287feb5709ffce10118d255cc9cc1e84b2d Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Fri, 11 Nov 2016 17:45:29 +0100 Subject: [PATCH 37/54] 8169599: Several JShell tests are failing on Solaris after JDK-8145838 Partially reverting e43f670394ca Reviewed-by: rfield --- .../execution/JdiDefaultExecutionControl.java | 40 +------------------ .../execution/RemoteExecutionControl.java | 21 ---------- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java index 8e22d330e82..ee266a30c17 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java @@ -24,7 +24,6 @@ */ package jdk.jshell.execution; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInput; @@ -33,14 +32,11 @@ import java.io.OutputStream; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; -import java.security.SecureRandom; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Consumer; - import com.sun.jdi.BooleanValue; import com.sun.jdi.ClassNotLoadedException; import com.sun.jdi.Field; @@ -127,14 +123,6 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl { VirtualMachine vm = jdii.vm(); Process process = jdii.process(); - OutputStream processOut = process.getOutputStream(); - SecureRandom rng = new SecureRandom(); - byte[] randomBytes = new byte[VERIFY_HASH_LEN]; - - rng.nextBytes(randomBytes); - processOut.write(randomBytes); - processOut.flush(); - List> deathListeners = new ArrayList<>(); deathListeners.add(s -> env.closeDown()); Util.detectJdiExitEvent(vm, s -> { @@ -143,8 +131,6 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl { } }); - ByteArrayOutputStream receivedRandomBytes = new ByteArrayOutputStream(); - // Set-up the commands/reslts on the socket. Piggy-back snippet // output. Socket socket = listener.accept(); @@ -153,35 +139,11 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl { Map outputs = new HashMap<>(); outputs.put("out", env.userOut()); outputs.put("err", env.userErr()); - outputs.put("echo", new OutputStream() { - @Override public void write(int b) throws IOException { - synchronized (receivedRandomBytes) { - receivedRandomBytes.write(b); - receivedRandomBytes.notify(); - } - } - }); Map input = new HashMap<>(); input.put("in", env.userIn()); - return remoteInputOutput(socket.getInputStream(), out, outputs, input, (objIn, objOut) -> { - synchronized (receivedRandomBytes) { - while (receivedRandomBytes.size() < randomBytes.length) { - try { - receivedRandomBytes.wait(); - } catch (InterruptedException ex) { - //ignore - } - } - if (!Arrays.equals(receivedRandomBytes.toByteArray(), randomBytes)) { - throw new IllegalStateException("Invalid connection!"); - } - } - return new JdiDefaultExecutionControl(objOut, objIn, vm, process, deathListeners); - }); + return remoteInputOutput(socket.getInputStream(), out, outputs, input, (objIn, objOut) -> new JdiDefaultExecutionControl(objOut, objIn, vm, process, deathListeners)); } } - //where: - private static final int VERIFY_HASH_LEN = 20; /** * Create an instance. diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java index 32330239d1f..81eac159b60 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java @@ -24,7 +24,6 @@ */ package jdk.jshell.execution; -import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; @@ -58,7 +57,6 @@ public class RemoteExecutionControl extends DirectExecutionControl implements Ex * @throws Exception any unexpected exception */ public static void main(String[] args) throws Exception { - InputStream fd0 = System.in; String loopBack = null; Socket socket = new Socket(loopBack, Integer.parseInt(args[0])); InputStream inStream = socket.getInputStream(); @@ -66,25 +64,6 @@ public class RemoteExecutionControl extends DirectExecutionControl implements Ex Map> outputs = new HashMap<>(); outputs.put("out", st -> System.setOut(new PrintStream(st, true))); outputs.put("err", st -> System.setErr(new PrintStream(st, true))); - outputs.put("echo", st -> { - new Thread(() -> { - try { - int read; - - while ((read = fd0.read()) != (-1)) { - st.write(read); - } - } catch (IOException ex) { - ex.printStackTrace(); - } finally { - try { - st.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - }).start(); - }); Map> input = new HashMap<>(); input.put("in", st -> System.setIn(st)); forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, outputs, input); From 8a2f4e80e4e6a1c2f58e5c99b01c2f9d81285ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Fri, 11 Nov 2016 18:56:37 +0100 Subject: [PATCH 38/54] 8168049: Fix Performance of Lexer.isJSWhitespace Reviewed-by: sundar, attila --- .../jdk/nashorn/internal/parser/Lexer.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java index 3b43249cdc7..24518223439 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java @@ -102,19 +102,9 @@ public class Lexer extends Scanner { private int templateExpressionOpenBraces; - private static final String SPACETAB = " \t"; // ASCII space and tab - private static final String LFCR = "\n\r"; // line feed and carriage return (ctrl-m) - - private static final String JAVASCRIPT_WHITESPACE_EOL = - LFCR + + private static final String JAVASCRIPT_OTHER_WHITESPACE = "\u2028" + // line separator - "\u2029" // paragraph separator - ; - private static final String JAVASCRIPT_WHITESPACE = - SPACETAB + - JAVASCRIPT_WHITESPACE_EOL + - "\u000b" + // tabulation line - "\u000c" + // ff (ctrl-l) + "\u2029" + // paragraph separator "\u00a0" + // Latin-1 space "\u1680" + // Ogham space mark "\u180e" + // separator, Mongolian vowel @@ -384,7 +374,13 @@ public class Lexer extends Scanner { * @return true if valid JavaScript whitespace */ public static boolean isJSWhitespace(final char ch) { - return JAVASCRIPT_WHITESPACE.indexOf(ch) != -1; + return ch == ' ' // space + || ch >= '\t' && ch <= '\r' // 0x09..0x0d: tab, line feed, tabulation line, ff, carriage return + || ch >= 160 && isOtherJSWhitespace(ch); + } + + private static boolean isOtherJSWhitespace(final char ch) { + return JAVASCRIPT_OTHER_WHITESPACE.indexOf(ch) != -1; } /** @@ -393,7 +389,10 @@ public class Lexer extends Scanner { * @return true if valid JavaScript end of line */ public static boolean isJSEOL(final char ch) { - return JAVASCRIPT_WHITESPACE_EOL.indexOf(ch) != -1; + return ch == '\n' // line feed + || ch == '\r' // carriage return (ctrl-m) + || ch == '\u2028' // line separator + || ch == '\u2029'; // paragraph separator } /** From 8899d192109302727541b1e0c54b22fb1409790c Mon Sep 17 00:00:00 2001 From: Robert Field Date: Fri, 11 Nov 2016 11:50:11 -0800 Subject: [PATCH 39/54] 8166333: jshell tool: shortcut var does not import its type Reviewed-by: jlahoda --- .../jshell/tool/ConsoleIOContext.java | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java index 16e9f65bd0c..a99a1fc5579 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java @@ -57,7 +57,6 @@ import jdk.internal.jline.TerminalFactory; import jdk.internal.jline.TerminalSupport; import jdk.internal.jline.WindowsTerminal; import jdk.internal.jline.console.ConsoleReader; -import jdk.internal.jline.console.CursorBuffer; import jdk.internal.jline.console.KeyMap; import jdk.internal.jline.console.UserInterruptException; import jdk.internal.jline.console.completer.Completer; @@ -581,26 +580,55 @@ class ConsoleIOContext extends IOContext { private static final FixComputer[] FIX_COMPUTERS = new FixComputer[] { new FixComputer('v', false) { //compute "Introduce variable" Fix: + private void performToVar(ConsoleReader in, String type) throws IOException { + in.redrawLine(); + in.setCursorPosition(0); + in.putString(type + " = "); + in.setCursorPosition(in.getCursorBuffer().cursor - 3); + in.flush(); + } + @Override public FixResult compute(JShellTool repl, String code, int cursor) { String type = repl.analysis.analyzeType(code, cursor); if (type == null) { return new FixResult(Collections.emptyList(), null); } - return new FixResult(Collections.singletonList(new Fix() { + List fixes = new ArrayList<>(); + fixes.add(new Fix() { @Override public String displayName() { return repl.messageFormat("jshell.console.create.variable"); } + @Override public void perform(ConsoleReader in) throws IOException { - in.redrawLine(); - in.setCursorPosition(0); - in.putString(type + " = "); - in.setCursorPosition(in.getCursorBuffer().cursor - 3); - in.flush(); + performToVar(in, type); } - }), null); + }); + int idx = type.lastIndexOf("."); + if (idx > 0) { + String stype = type.substring(idx + 1); + QualifiedNames res = repl.analysis.listQualifiedNames(stype, stype.length()); + if (res.isUpToDate() && res.getNames().contains(type) + && !res.isResolvable()) { + fixes.add(new Fix() { + @Override + public String displayName() { + return "import: " + type + ". " + + repl.messageFormat("jshell.console.create.variable"); + } + + @Override + public void perform(ConsoleReader in) throws IOException { + repl.state.eval("import " + type + ";"); + in.println("Imported: " + type); + performToVar(in, stype); + } + }); + } + } + return new FixResult(fixes, null); } }, new FixComputer('i', true) { //compute "Add import" Fixes: @@ -614,6 +642,7 @@ class ConsoleIOContext extends IOContext { public String displayName() { return "import: " + fqn; } + @Override public void perform(ConsoleReader in) throws IOException { repl.state.eval("import " + fqn + ";"); From 40e24f2e56a9d55da80366044531a4e1f68b1ae0 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Fri, 11 Nov 2016 17:32:21 -0800 Subject: [PATCH 40/54] 8168386: Fix jdeps verbose options Reviewed-by: dfuchs, lancea --- .../com/sun/tools/jdeps/JdepsTask.java | 715 ++++++++++++------ .../com/sun/tools/jdeps/ModuleAnalyzer.java | 8 - .../tools/jdeps/resources/jdeps.properties | 10 +- langtools/test/tools/jdeps/DotFileTest.java | 4 - langtools/test/tools/jdeps/Options.java | 92 +++ .../test/tools/jdeps/lib/JdepsRunner.java | 2 +- 6 files changed, 587 insertions(+), 244 deletions(-) create mode 100644 langtools/test/tools/jdeps/Options.java diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java index dca3f476d3c..af5bfb50041 100644 --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java @@ -25,8 +25,10 @@ package com.sun.tools.jdeps; +import com.sun.tools.jdeps.Analyzer.Type; import static com.sun.tools.jdeps.Analyzer.Type.*; import static com.sun.tools.jdeps.JdepsWriter.*; +import static java.util.stream.Collectors.*; import java.io.IOException; import java.io.PrintWriter; @@ -111,6 +113,10 @@ class JdepsTask { this.aliases = aliases; } + Option(boolean hasArg, CommandOption cmd) { + this(hasArg, cmd.names()); + } + boolean isHidden() { return false; } @@ -144,25 +150,46 @@ class JdepsTask { } } + enum CommandOption { + ANALYZE_DEPS(""), + GENERATE_DOT_FILE("-dotoutput", "--dot-output"), + GENERATE_MODULE_INFO("--generate-module-info"), + LIST_DEPS("--list-deps"), + LIST_REDUCED_DEPS("--list-reduced-deps"), + CHECK_MODULES("--check"); + + private final String[] names; + CommandOption(String... names) { + this.names = names; + } + + String[] names() { + return names; + } + + @Override + public String toString() { + return names[0]; + } + } + static Option[] recognizedOptions = { new Option(false, "-h", "-?", "-help", "--help") { void process(JdepsTask task, String opt, String arg) { task.options.help = true; } }, - new Option(true, "-dotoutput", "--dot-output") { + new Option(true, CommandOption.GENERATE_DOT_FILE) { void process(JdepsTask task, String opt, String arg) throws BadArgs { - Path p = Paths.get(arg); - if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) { - throw new BadArgs("err.invalid.path", arg); + if (task.command != null) { + throw new BadArgs("err.command.set", task.command, opt); } - task.options.dotOutputDir = Paths.get(arg);; + task.command = task.genDotFile(Paths.get(arg)); } }, new Option(false, "-s", "-summary") { void process(JdepsTask task, String opt, String arg) { task.options.showSummary = true; - task.options.verbose = SUMMARY; } }, new Option(false, "-v", "-verbose", @@ -196,35 +223,48 @@ class JdepsTask { task.options.apiOnly = true; } }, - new Option(true, "--check") { - void process(JdepsTask task, String opt, String arg) throws BadArgs { - Set mods = Set.of(arg.split(",")); - task.options.checkModuleDeps = mods; - task.options.addmods.addAll(mods); - } - }, - new Option(true, "--generate-module-info") { - void process(JdepsTask task, String opt, String arg) throws BadArgs { - Path p = Paths.get(arg); - if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) { - throw new BadArgs("err.invalid.path", arg); - } - task.options.genModuleInfo = Paths.get(arg); - } - }, + new Option(false, "-jdkinternals", "--jdk-internals") { void process(JdepsTask task, String opt, String arg) { task.options.findJDKInternals = true; - task.options.verbose = CLASS; if (task.options.includePattern == null) { task.options.includePattern = Pattern.compile(".*"); } } }, - new Option(false, "--list-deps", "--list-reduced-deps") { - void process(JdepsTask task, String opt, String arg) { - task.options.showModulesAddExports = true; - task.options.reduced = opt.equals("--list-reduced-deps"); + + new Option(true, CommandOption.CHECK_MODULES) { + void process(JdepsTask task, String opt, String arg) throws BadArgs { + if (task.command != null) { + throw new BadArgs("err.command.set", task.command, opt); + } + Set mods = Set.of(arg.split(",")); + task.options.addmods.addAll(mods); + task.command = task.checkModuleDeps(mods); + } + }, + new Option(true, CommandOption.GENERATE_MODULE_INFO) { + void process(JdepsTask task, String opt, String arg) throws BadArgs { + if (task.command != null) { + throw new BadArgs("err.command.set", task.command, opt); + } + task.command = task.genModuleInfo(Paths.get(arg)); + } + }, + new Option(false, CommandOption.LIST_DEPS) { + void process(JdepsTask task, String opt, String arg) throws BadArgs { + if (task.command != null) { + throw new BadArgs("err.command.set", task.command, opt); + } + task.command = task.listModuleDeps(false); + } + }, + new Option(false, CommandOption.LIST_REDUCED_DEPS) { + void process(JdepsTask task, String opt, String arg) throws BadArgs { + if (task.command != null) { + throw new BadArgs("err.command.set", task.command, opt); + } + task.command = task.listModuleDeps(true); } }, @@ -419,6 +459,7 @@ class JdepsTask { private final Options options = new Options(); private final List inputArgs = new ArrayList<>(); + private Command command; private PrintWriter log; void setLog(PrintWriter out) { log = out; @@ -445,55 +486,30 @@ class JdepsTask { if (options.version || options.fullVersion) { showVersion(options.fullVersion); } + if (options.help || options.version || options.fullVersion) { + return EXIT_OK; + } + if (!inputArgs.isEmpty() && options.rootModule != null) { reportError("err.invalid.arg.for.option", "-m"); } - if (inputArgs.isEmpty() && options.addmods.isEmpty() && options.includePattern == null - && options.includeSystemModulePattern == null && options.checkModuleDeps == null) { - if (options.help || options.version || options.fullVersion) { - return EXIT_OK; - } else { - showHelp(); - return EXIT_CMDERR; - } - } - if (options.genModuleInfo != null) { - if (options.dotOutputDir != null || options.classpath != null || options.hasFilter()) { - showHelp(); - return EXIT_CMDERR; - } - } if (options.numFilters() > 1) { reportError("err.invalid.filters"); return EXIT_CMDERR; } - if (options.inverse && options.depth != 1) { - reportError("err.invalid.inverse.option", "-R"); - return EXIT_CMDERR; + // default command to analyze dependences + if (command == null) { + command = analyzeDeps(); } - - if (options.inverse && options.numFilters() == 0) { - reportError("err.invalid.filters"); - return EXIT_CMDERR; - } - - if ((options.findJDKInternals) && (options.hasFilter() || options.showSummary)) { - showHelp(); - return EXIT_CMDERR; - } - if (options.showSummary && options.verbose != SUMMARY) { - showHelp(); - return EXIT_CMDERR; - } - if (options.checkModuleDeps != null && !inputArgs.isEmpty()) { - reportError("err.invalid.module.option", inputArgs, "--check"); + if (!command.checkOptions()) { return EXIT_CMDERR; } boolean ok = run(); return ok ? EXIT_OK : EXIT_ERROR; + } catch (BadArgs|UncheckedBadArgs e) { reportError(e.getKey(), e.getArgs()); if (e.showUsage()) { @@ -515,13 +531,14 @@ class JdepsTask { } boolean run() throws IOException { - try (JdepsConfiguration config = buildConfig()) { + try (JdepsConfiguration config = buildConfig(command.allModules())) { // detect split packages - config.splitPackages().entrySet().stream() + config.splitPackages().entrySet() + .stream() .sorted(Map.Entry.comparingByKey()) .forEach(e -> System.out.format("split package: %s %s%n", e.getKey(), - e.getValue().toString())); + e.getValue().toString())); // check if any module specified in --require is missing Stream.concat(options.addmods.stream(), options.requires.stream()) @@ -529,38 +546,11 @@ class JdepsTask { .forEach(mn -> config.findModule(mn).orElseThrow(() -> new UncheckedBadArgs(new BadArgs("err.module.not.found", mn)))); - // --generate-module-info - if (options.genModuleInfo != null) { - return genModuleInfo(config); - } - - // --check - if (options.checkModuleDeps != null) { - return new ModuleAnalyzer(config, log, options.checkModuleDeps).run(); - } - - if (options.showModulesAddExports) { - return new ModuleExportsAnalyzer(config, - dependencyFilter(config), - options.reduced, - log).run(); - } - - if (options.dotOutputDir != null && - (options.verbose == SUMMARY || options.verbose == MODULE) && - !options.addmods.isEmpty() && inputArgs.isEmpty()) { - return new ModuleAnalyzer(config, log).genDotFiles(options.dotOutputDir); - } - - if (options.inverse) { - return analyzeInverseDeps(config); - } else { - return analyzeDeps(config); - } + return command.run(config); } } - private JdepsConfiguration buildConfig() throws IOException { + private JdepsConfiguration buildConfig(boolean allModules) throws IOException { JdepsConfiguration.Builder builder = new JdepsConfiguration.Builder(options.systemModulePath); @@ -568,7 +558,7 @@ class JdepsTask { .appModulePath(options.modulePath) .addmods(options.addmods); - if (options.checkModuleDeps != null || options.showModulesAddExports) { + if (allModules) { // check all system modules in the image builder.allModules(); } @@ -592,148 +582,420 @@ class JdepsTask { return builder.build(); } - private boolean analyzeDeps(JdepsConfiguration config) throws IOException { - // output result - final JdepsWriter writer; - if (options.dotOutputDir != null) { - writer = new DotFileWriter(options.dotOutputDir, - options.verbose, - options.showProfile, - options.showModule, - options.showLabel); - } else { - writer = new SimpleWriter(log, - options.verbose, - options.showProfile, - options.showModule); - } + // ---- factory methods to create a Command - // analyze the dependencies - DepsAnalyzer analyzer = new DepsAnalyzer(config, - dependencyFilter(config), - writer, - options.verbose, - options.apiOnly); - - boolean ok = analyzer.run(options.compileTimeView, options.depth); - - // print skipped entries, if any - if (!options.nowarning) { - analyzer.archives() - .forEach(archive -> archive.reader() - .skippedEntries().stream() - .forEach(name -> warning("warn.skipped.entry", name))); - } - - if (options.findJDKInternals && !options.nowarning) { - Map jdkInternals = new TreeMap<>(); - Set deps = analyzer.dependences(); - // find the ones with replacement - deps.forEach(cn -> replacementFor(cn).ifPresent( - repl -> jdkInternals.put(cn, repl)) - ); - - if (!deps.isEmpty()) { - log.println(); - warning("warn.replace.useJDKInternals", getMessage("jdeps.wiki.url")); - } - - if (!jdkInternals.isEmpty()) { - log.println(); - log.format("%-40s %s%n", "JDK Internal API", "Suggested Replacement"); - log.format("%-40s %s%n", "----------------", "---------------------"); - jdkInternals.entrySet().stream() - .forEach(e -> { - String key = e.getKey(); - String[] lines = e.getValue().split("\\n"); - for (String s : lines) { - log.format("%-40s %s%n", key, s); - key = ""; - } - }); - } - } - return ok; + private AnalyzeDeps analyzeDeps() throws BadArgs { + return options.inverse ? new InverseAnalyzeDeps() + : new AnalyzeDeps(); } - private boolean analyzeInverseDeps(JdepsConfiguration config) throws IOException { - JdepsWriter writer = new SimpleWriter(log, - options.verbose, - options.showProfile, - options.showModule); - - InverseDepsAnalyzer analyzer = new InverseDepsAnalyzer(config, - dependencyFilter(config), - writer, - options.verbose, - options.apiOnly); - boolean ok = analyzer.run(); - - log.println(); - if (!options.requires.isEmpty()) - log.format("Inverse transitive dependences on %s%n", options.requires); - else - log.format("Inverse transitive dependences matching %s%n", - options.regex != null - ? options.regex.toString() - : "packages " + options.packageNames); - - analyzer.inverseDependences().stream() - .sorted(Comparator.comparing(this::sortPath)) - .forEach(path -> log.println(path.stream() - .map(Archive::getName) - .collect(Collectors.joining(" <- ")))); - return ok; + private GenDotFile genDotFile(Path dir) throws BadArgs { + if (Files.exists(dir) && (!Files.isDirectory(dir) || !Files.isWritable(dir))) { + throw new BadArgs("err.invalid.path", dir.toString()); + } + return new GenDotFile(dir); } - private String sortPath(Deque path) { - return path.peekFirst().getName(); + private GenModuleInfo genModuleInfo(Path dir) throws BadArgs { + if (Files.exists(dir) && (!Files.isDirectory(dir) || !Files.isWritable(dir))) { + throw new BadArgs("err.invalid.path", dir.toString()); + } + return new GenModuleInfo(dir); } - private boolean genModuleInfo(JdepsConfiguration config) throws IOException { - // check if any JAR file contains unnamed package - for (String arg : inputArgs) { - try (ClassFileReader reader = ClassFileReader.newInstance(Paths.get(arg))) { - Optional classInUnnamedPackage = - reader.entries().stream() - .filter(n -> n.endsWith(".class")) - .filter(cn -> toPackageName(cn).isEmpty()) - .findFirst(); + private ListModuleDeps listModuleDeps(boolean reduced) throws BadArgs { + return reduced ? new ListReducedDeps() + : new ListModuleDeps(); + } - if (classInUnnamedPackage.isPresent()) { - if (classInUnnamedPackage.get().equals("module-info.class")) { - reportError("err.genmoduleinfo.not.jarfile", arg); - } else { - reportError("err.genmoduleinfo.unnamed.package", arg); - } + private CheckModuleDeps checkModuleDeps(Set mods) throws BadArgs { + return new CheckModuleDeps(mods); + } + + abstract class Command { + final CommandOption option; + protected Command(CommandOption option) { + this.option = option; + } + /** + * Returns true if the command-line options are all valid; + * otherwise, returns false. + */ + abstract boolean checkOptions(); + + /** + * Do analysis + */ + abstract boolean run(JdepsConfiguration config) throws IOException; + + /** + * Includes all modules on system module path and application module path + */ + boolean allModules() { + return false; + } + + @Override + public String toString() { + return option.toString(); + } + } + + + /** + * Analyze dependences + */ + class AnalyzeDeps extends Command { + JdepsWriter writer; + AnalyzeDeps() { + this(CommandOption.ANALYZE_DEPS); + } + + AnalyzeDeps(CommandOption option) { + super(option); + } + + @Override + boolean checkOptions() { + if (options.findJDKInternals) { + // cannot set any filter, -verbose and -summary option + if (options.showSummary || options.verbose != null) { + reportError("err.invalid.options", "-summary or -verbose", + "-jdkinternals"); + return false; + } + if (options.hasFilter()) { + reportError("err.invalid.options", "--package, --regex, --require", + "-jdkinternals"); return false; } } + if (options.showSummary) { + // -summary cannot use with -verbose option + if (options.verbose != null) { + reportError("err.invalid.options", "-v, -verbose", "-s, -summary"); + return false; + } + } + if (inputArgs.isEmpty() && !options.hasSourcePath()) { + showHelp(); + return false; + } + return true; } - ModuleInfoBuilder builder - = new ModuleInfoBuilder(config, inputArgs, options.genModuleInfo); - boolean ok = builder.run(); + /* + * Default is to show package-level dependencies + */ + Type getAnalyzerType() { + if (options.showSummary) + return Type.SUMMARY; - if (!ok && !options.nowarning) { - log.println("ERROR: missing dependencies"); - builder.visitMissingDeps( - new Analyzer.Visitor() { - @Override - public void visitDependence(String origin, Archive originArchive, - String target, Archive targetArchive) { - if (builder.notFound(targetArchive)) - log.format(" %-50s -> %-50s %s%n", - origin, target, targetArchive.getName()); - } - }); + if (options.findJDKInternals) + return Type.CLASS; + + // default to package-level verbose + return options.verbose != null ? options.verbose : PACKAGE; + } + + @Override + boolean run(JdepsConfiguration config) throws IOException { + Type type = getAnalyzerType(); + // default to package-level verbose + JdepsWriter writer = new SimpleWriter(log, + type, + options.showProfile, + options.showModule); + + return run(config, writer, type); + } + + boolean run(JdepsConfiguration config, JdepsWriter writer, Type type) throws IOException { + + + // analyze the dependencies + DepsAnalyzer analyzer = new DepsAnalyzer(config, + dependencyFilter(config), + writer, + type, + options.apiOnly); + + boolean ok = analyzer.run(options.compileTimeView, options.depth); + + // print skipped entries, if any + if (!options.nowarning) { + analyzer.archives() + .forEach(archive -> archive.reader() + .skippedEntries().stream() + .forEach(name -> warning("warn.skipped.entry", name))); + } + + if (options.findJDKInternals && !options.nowarning) { + Map jdkInternals = new TreeMap<>(); + Set deps = analyzer.dependences(); + // find the ones with replacement + deps.forEach(cn -> replacementFor(cn).ifPresent( + repl -> jdkInternals.put(cn, repl)) + ); + + if (!deps.isEmpty()) { + log.println(); + warning("warn.replace.useJDKInternals", getMessage("jdeps.wiki.url")); + } + + if (!jdkInternals.isEmpty()) { + log.println(); + log.format("%-40s %s%n", "JDK Internal API", "Suggested Replacement"); + log.format("%-40s %s%n", "----------------", "---------------------"); + jdkInternals.entrySet().stream() + .forEach(e -> { + String key = e.getKey(); + String[] lines = e.getValue().split("\\n"); + for (String s : lines) { + log.format("%-40s %s%n", key, s); + key = ""; + } + }); + } + } + return ok; } - return ok; } - private String toPackageName(String name) { - int i = name.lastIndexOf('/'); - return i > 0 ? name.replace('/', '.').substring(0, i) : ""; + + class InverseAnalyzeDeps extends AnalyzeDeps { + InverseAnalyzeDeps() { + } + + @Override + boolean checkOptions() { + if (options.depth != 1) { + reportError("err.invalid.options", "-R", "--inverse"); + return false; + } + + if (options.numFilters() == 0) { + reportError("err.filter.not.specified"); + return false; + } + + if (!super.checkOptions()) { + return false; + } + + return true; + } + + @Override + boolean run(JdepsConfiguration config) throws IOException { + Type type = getAnalyzerType(); + + InverseDepsAnalyzer analyzer = + new InverseDepsAnalyzer(config, + dependencyFilter(config), + writer, + type, + options.apiOnly); + boolean ok = analyzer.run(); + + log.println(); + if (!options.requires.isEmpty()) + log.format("Inverse transitive dependences on %s%n", options.requires); + else + log.format("Inverse transitive dependences matching %s%n", + options.regex != null + ? options.regex.toString() + : "packages " + options.packageNames); + + analyzer.inverseDependences().stream() + .sorted(Comparator.comparing(this::sortPath)) + .forEach(path -> log.println(path.stream() + .map(Archive::getName) + .collect(joining(" <- ")))); + return ok; + } + + private String sortPath(Deque path) { + return path.peekFirst().getName(); + } + } + + + class GenModuleInfo extends Command { + final Path dir; + GenModuleInfo(Path dir) { + super(CommandOption.GENERATE_MODULE_INFO); + this.dir = dir; + } + + @Override + boolean checkOptions() { + if (options.classpath != null) { + reportError("err.invalid.options", "-classpath", + option); + return false; + } + if (options.hasFilter()) { + reportError("err.invalid.options", "--package, --regex, --require", + option); + return false; + } + return true; + } + + @Override + boolean run(JdepsConfiguration config) throws IOException { + // check if any JAR file contains unnamed package + for (String arg : inputArgs) { + try (ClassFileReader reader = ClassFileReader.newInstance(Paths.get(arg))) { + Optional classInUnnamedPackage = + reader.entries().stream() + .filter(n -> n.endsWith(".class")) + .filter(cn -> toPackageName(cn).isEmpty()) + .findFirst(); + + if (classInUnnamedPackage.isPresent()) { + if (classInUnnamedPackage.get().equals("module-info.class")) { + reportError("err.genmoduleinfo.not.jarfile", arg); + } else { + reportError("err.genmoduleinfo.unnamed.package", arg); + } + return false; + } + } + } + + ModuleInfoBuilder builder + = new ModuleInfoBuilder(config, inputArgs, dir); + boolean ok = builder.run(); + + if (!ok && !options.nowarning) { + log.println("ERROR: missing dependencies"); + builder.visitMissingDeps( + new Analyzer.Visitor() { + @Override + public void visitDependence(String origin, Archive originArchive, + String target, Archive targetArchive) { + if (builder.notFound(targetArchive)) + log.format(" %-50s -> %-50s %s%n", + origin, target, targetArchive.getName()); + } + }); + } + return ok; + } + + private String toPackageName(String name) { + int i = name.lastIndexOf('/'); + return i > 0 ? name.replace('/', '.').substring(0, i) : ""; + } + } + + class CheckModuleDeps extends Command { + final Set modules; + CheckModuleDeps(Set mods) { + super(CommandOption.CHECK_MODULES); + this.modules = mods; + } + + @Override + boolean checkOptions() { + if (!inputArgs.isEmpty()) { + reportError("err.invalid.options", inputArgs, "--check"); + return false; + } + return true; + } + + @Override + boolean run(JdepsConfiguration config) throws IOException { + if (!config.initialArchives().isEmpty()) { + String list = config.initialArchives().stream() + .map(Archive::getPathName).collect(joining(" ")); + throw new UncheckedBadArgs(new BadArgs("err.invalid.options", + list, "--check")); + } + return new ModuleAnalyzer(config, log, modules).run(); + } + + public boolean allModules() { + return true; + } + } + + class ListReducedDeps extends ListModuleDeps { + ListReducedDeps() { + super(CommandOption.LIST_REDUCED_DEPS, true); + } + } + + class ListModuleDeps extends Command { + final boolean reduced; + ListModuleDeps() { + this(CommandOption.LIST_DEPS, false); + } + ListModuleDeps(CommandOption option, boolean reduced) { + super(option); + this.reduced = reduced; + } + + @Override + boolean checkOptions() { + if (options.showSummary || options.verbose != null) { + reportError("err.invalid.options", "-summary or -verbose", + option); + return false; + } + if (options.findJDKInternals) { + reportError("err.invalid.options", "-jdkinternals", + option); + return false; + } + if (inputArgs.isEmpty() && !options.hasSourcePath()) { + showHelp(); + return false; + } + return true; + } + + @Override + boolean run(JdepsConfiguration config) throws IOException { + return new ModuleExportsAnalyzer(config, + dependencyFilter(config), + reduced, + log).run(); + } + + public boolean allModules() { + return true; + } + } + + + class GenDotFile extends AnalyzeDeps { + final Path dotOutputDir; + GenDotFile(Path dotOutputDir) { + super(CommandOption.GENERATE_DOT_FILE); + + this.dotOutputDir = dotOutputDir; + } + + @Override + boolean run(JdepsConfiguration config) throws IOException { + if ((options.showSummary || options.verbose == MODULE) && + !options.addmods.isEmpty() && inputArgs.isEmpty()) { + // print module descriptor + return new ModuleAnalyzer(config, log).genDotFiles(dotOutputDir); + } + + Type type = getAnalyzerType(); + JdepsWriter writer = new DotFileWriter(dotOutputDir, + type, + options.showProfile, + options.showModule, + options.showLabel); + return run(config, writer, type); + } } /** @@ -875,14 +1137,11 @@ class JdepsTask { boolean showLabel; boolean findJDKInternals; boolean nowarning = false; - // default is to show package-level dependencies - // and filter references from same package - Analyzer.Type verbose = PACKAGE; + Analyzer.Type verbose; + // default filter references from same package boolean filterSamePackage = true; boolean filterSameArchive = false; Pattern filterRegex; - Path dotOutputDir; - Path genModuleInfo; String classpath; int depth = 1; Set requires = new HashSet<>(); @@ -892,15 +1151,17 @@ class JdepsTask { Pattern includeSystemModulePattern; boolean inverse = false; boolean compileTimeView = false; - Set checkModuleDeps; String systemModulePath = System.getProperty("java.home"); String upgradeModulePath; String modulePath; String rootModule; Set addmods = new HashSet<>(); Runtime.Version multiRelease; - boolean showModulesAddExports; - boolean reduced; + + boolean hasSourcePath() { + return !addmods.isEmpty() || includePattern != null || + includeSystemModulePattern != null; + } boolean hasFilter() { return numFilters() > 0; diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java index c5a5a971158..9c0d65cfc1a 100644 --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java @@ -70,14 +70,6 @@ public class ModuleAnalyzer { public ModuleAnalyzer(JdepsConfiguration config, PrintWriter log, Set names) { - - if (!config.initialArchives().isEmpty()) { - String list = config.initialArchives().stream() - .map(Archive::getPathName).collect(joining(" ")); - throw new JdepsTask.UncheckedBadArgs(new BadArgs("err.invalid.module.option", - list, "--check")); - } - this.configuration = config; this.log = log; diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties index 8bff48b92dc..4189ae86745 100644 --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties @@ -151,7 +151,9 @@ main.opt.jdkinternals=\ main.opt.list-deps=\ \ --list-deps Lists the dependences and use of JDK internal\n\ -\ APIs.\n\ +\ APIs. + +main.opt.list-reduced-deps=\ \ --list-reduced-deps Same as --list-deps with not listing\n\ \ the implied reads edges from the module graph\n\ \ If module M1 depends on M2 and M3,\n\ @@ -171,6 +173,7 @@ main.opt.multi-release=\ \ multi-release jar files. should\n\ \ be integer >= 9 or base. +err.command.set={0} and {1} options are specified. err.unknown.option=unknown option: {0} err.missing.arg=no value given for {0} err.invalid.arg.for.option=invalid argument for option: {0} @@ -180,11 +183,10 @@ err.genmoduleinfo.unnamed.package={0} contains an unnamed package that is not al err.profiles.msg=No profile information err.exception.message={0} err.invalid.path=invalid path: {0} -err.invalid.module.option=Cannot set {0} with {1} option. -err.invalid.filters=Only one of --package (-p), --regex (-e), --require option can be set +err.invalid.options={0} cannot be used with {1} option err.module.not.found=module not found: {0} err.root.module.not.set=root module set empty -err.invalid.inverse.option={0} cannot be used with --inverse option +err.filter.not.specified=--package (-p), --regex (-e), --require option must be specified err.multirelease.option.exists={0} is not a multi-release jar file, but the --multi-release option is set err.multirelease.option.notfound={0} is a multi-release jar file, but the --multi-release option is not set err.multirelease.version.associated=class {0} already associated with version {1}, trying to add version {2} diff --git a/langtools/test/tools/jdeps/DotFileTest.java b/langtools/test/tools/jdeps/DotFileTest.java index 0dd4296776c..944d3a3694d 100644 --- a/langtools/test/tools/jdeps/DotFileTest.java +++ b/langtools/test/tools/jdeps/DotFileTest.java @@ -136,8 +136,6 @@ public class DotFileTest { // with -P option List argsWithDashP = new ArrayList<>(); - argsWithDashP.add("-dotoutput"); - argsWithDashP.add(dotoutput.toString()); argsWithDashP.add("-P"); argsWithDashP.addAll(args); @@ -162,8 +160,6 @@ public class DotFileTest { // with -P option List argsWithDashP = new ArrayList<>(); - argsWithDashP.add("-dotoutput"); - argsWithDashP.add(dotoutput.toString()); argsWithDashP.add("-P"); argsWithDashP.addAll(args); diff --git a/langtools/test/tools/jdeps/Options.java b/langtools/test/tools/jdeps/Options.java new file mode 100644 index 00000000000..40da51047c8 --- /dev/null +++ b/langtools/test/tools/jdeps/Options.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2016, 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 8168386 + * @summary Test option validation + * @modules jdk.jdeps + * @library lib + * @build JdepsRunner + * @run testng Options + */ + + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + +public class Options { + private static final String TEST_CLASSES = System.getProperty("test.classes"); + + @DataProvider(name = "errors") + public Object[][] errors() { + return new Object[][]{ + { + new String[] { "-summary", "-v", TEST_CLASSES }, + "-v, -verbose cannot be used with -s, -summary option" + }, + { + new String[] { "-jdkinternal", "-summary", TEST_CLASSES }, + "-summary or -verbose cannot be used with -jdkinternals option" + }, + { + new String[] { "-jdkinternal", "-p", "java.lang", TEST_CLASSES }, + "--package, --regex, --require cannot be used with -jdkinternals option" + }, + { + new String[] { "--inverse", TEST_CLASSES }, + "--package (-p), --regex (-e), --require option must be specified" + }, + { + new String[] { "--inverse", "-R", TEST_CLASSES }, + "-R cannot be used with --inverse option" + }, + { + new String[] { "--generate-module-info", "dots", "-cp", TEST_CLASSES }, + "-classpath cannot be used with --generate-module-info option" + }, + { + new String[] { "--list-deps", "-summary", TEST_CLASSES }, + "--list-deps and --list-reduced-deps options are specified" + }, + { + new String[] { "--list-deps", "--list-reduced-deps", TEST_CLASSES }, + "--list-deps and --list-reduced-deps options are specified" + }, + }; + } + + @Test(dataProvider = "errors") + public void test(String[] options, String expected) { + jdepsError(options).outputContains(expected); + } + + + public static JdepsRunner jdepsError(String... args) { + JdepsRunner jdeps = new JdepsRunner(args); + assertTrue(jdeps.run(true) != 0); + return jdeps; + } +} diff --git a/langtools/test/tools/jdeps/lib/JdepsRunner.java b/langtools/test/tools/jdeps/lib/JdepsRunner.java index 5d93f2fbd5a..1161558beaa 100644 --- a/langtools/test/tools/jdeps/lib/JdepsRunner.java +++ b/langtools/test/tools/jdeps/lib/JdepsRunner.java @@ -75,7 +75,7 @@ public class JdepsRunner { } public boolean outputContains(String s) { - return stdout.toString().contains(s); + return stdout.toString().contains(s) || stderr.toString().contains(s); } public void printStdout(PrintStream stream) { From 4e5211401e6c07777c0d20a656968bfae21c41fb Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Sat, 12 Nov 2016 09:26:08 -0800 Subject: [PATCH 41/54] 8169606: jdeps --list-reduced-deps should not show java.base as all modules require it Reviewed-by: dfuchs --- .../sun/tools/jdeps/JdepsConfiguration.java | 11 ++++-- .../com/sun/tools/jdeps/JdepsTask.java | 3 +- .../classes/com/sun/tools/jdeps/Module.java | 2 +- .../tools/jdeps/ModuleExportsAnalyzer.java | 35 +++++++++++++------ .../tools/jdeps/listdeps/ListModuleDeps.java | 17 +++++++-- .../test/tools/jdeps/listdeps/src/hi/Hi.java | 27 ++++++++++++++ 6 files changed, 79 insertions(+), 16 deletions(-) create mode 100644 langtools/test/tools/jdeps/listdeps/src/hi/Hi.java diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java index 02d6bc6ea9b..44159653d95 100644 --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java @@ -89,6 +89,7 @@ public class JdepsConfiguration implements AutoCloseable { List classpaths, List initialArchives, boolean allDefaultModules, + boolean allSystemModules, Runtime.Version version) throws IOException { @@ -107,6 +108,11 @@ public class JdepsConfiguration implements AutoCloseable { roots.isEmpty() || allDefaultModules) { mods.addAll(systemModulePath.defaultSystemRoots()); } + if (allSystemModules) { + systemModulePath.findAll().stream() + .map(mref -> mref.descriptor().name()) + .forEach(mods::add); + } this.configuration = Configuration.empty() .resolveRequires(finder, ModuleFinder.of(), mods); @@ -488,6 +494,7 @@ public class JdepsConfiguration implements AutoCloseable { ModuleFinder appModulePath; boolean addAllApplicationModules; boolean addAllDefaultModules; + boolean addAllSystemModules; Runtime.Version version; public Builder() { @@ -533,8 +540,7 @@ public class JdepsConfiguration implements AutoCloseable { * Include all system modules and modules found on modulepath */ public Builder allModules() { - systemModulePath.moduleNames() - .forEach(this.rootModules::add); + this.addAllSystemModules = true; this.addAllApplicationModules = true; return this; } @@ -588,6 +594,7 @@ public class JdepsConfiguration implements AutoCloseable { classPaths, initialArchives, addAllDefaultModules, + addAllSystemModules, version); } diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java index af5bfb50041..3ed77929c9c 100644 --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java @@ -966,7 +966,8 @@ class JdepsTask { log).run(); } - public boolean allModules() { + @Override + boolean allModules() { return true; } } diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java index 810498b6718..f00394a05a3 100644 --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java @@ -81,7 +81,7 @@ class Module extends Archive { * Returns module name */ public String name() { - return descriptor.name(); + return descriptor != null ? descriptor.name() : getName(); } public boolean isNamed() { diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java index 79847e6d6ec..8d7b82094a1 100644 --- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java +++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java @@ -33,6 +33,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import static com.sun.tools.jdeps.Analyzer.NOT_FOUND; @@ -140,20 +141,34 @@ public class ModuleExportsAnalyzer extends DepsAnalyzer { Set modules = builder.build().adjacentNodes(root); // if reduced is set, apply transition reduction - Set reducedSet = reduced ? builder.reduced().adjacentNodes(root) - : modules; + Set reducedSet; + if (reduced) { + Set nodes = builder.reduced().adjacentNodes(root); + if (nodes.size() == 1) { + // java.base only + reducedSet = nodes; + } else { + // java.base is mandated and can be excluded from the reduced graph + reducedSet = nodes.stream() + .filter(m -> !"java.base".equals(m.name()) || + jdkinternals.containsKey("java.base")) + .collect(Collectors.toSet()); + } + } else { + reducedSet = modules; + } modules.stream() .sorted(Comparator.comparing(Module::name)) .forEach(m -> { - if (jdkinternals.containsKey(m)) { - jdkinternals.get(m).stream() - .sorted() - .forEach(pn -> writer.format(" %s/%s%n", m, pn)); - } else if (reducedSet.contains(m)){ - // if the transition reduction is applied, show the reduced graph - writer.format(" %s%n", m); - } + if (jdkinternals.containsKey(m)) { + jdkinternals.get(m).stream() + .sorted() + .forEach(pn -> writer.format(" %s/%s%n", m, pn)); + } else if (reducedSet.contains(m)){ + // if the transition reduction is applied, show the reduced graph + writer.format(" %s%n", m); + } }); } diff --git a/langtools/test/tools/jdeps/listdeps/ListModuleDeps.java b/langtools/test/tools/jdeps/listdeps/ListModuleDeps.java index 1456fed1e19..9327565881a 100644 --- a/langtools/test/tools/jdeps/listdeps/ListModuleDeps.java +++ b/langtools/test/tools/jdeps/listdeps/ListModuleDeps.java @@ -24,7 +24,7 @@ /* * @test * @bug 8167057 - * @summary Tests split packages + * @summary Tests --list-deps and --list-reduced-deps options * @modules java.logging * java.xml * jdk.compiler @@ -53,6 +53,8 @@ public class ListModuleDeps { private static final Path CLASSES_DIR = Paths.get("classes"); private static final Path LIB_DIR = Paths.get("lib"); + private static final Path HI_CLASS = + CLASSES_DIR.resolve("hi").resolve("Hi.class"); private static final Path FOO_CLASS = CLASSES_DIR.resolve("z").resolve("Foo.class"); private static final Path BAR_CLASS = @@ -68,6 +70,9 @@ public class ListModuleDeps { // compile library assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "lib"), LIB_DIR)); + // simple program depends only on java.base + assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "hi"), CLASSES_DIR)); + // compile classes in unnamed module assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "z"), CLASSES_DIR, @@ -117,6 +122,11 @@ public class ListModuleDeps { } }, + { HI_CLASS, new String[] { + "java.base" + } + }, + { FOO_CLASS, new String[] { "java.base", "java.logging", @@ -155,9 +165,12 @@ public class ListModuleDeps { } }, + { HI_CLASS, new String[] { + "java.base" + } + }, { FOO_CLASS, new String[] { - "java.base", "java.sql", "unnamed module: lib" } diff --git a/langtools/test/tools/jdeps/listdeps/src/hi/Hi.java b/langtools/test/tools/jdeps/listdeps/src/hi/Hi.java new file mode 100644 index 00000000000..248ae724365 --- /dev/null +++ b/langtools/test/tools/jdeps/listdeps/src/hi/Hi.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, 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. + */ + +package hi; + +public class Hi { +} From 95d99302d82d78f185dc1b44e05aa57304f3bb95 Mon Sep 17 00:00:00 2001 From: Srikanth Adayapalam Date: Mon, 14 Nov 2016 19:45:41 +0530 Subject: [PATCH 42/54] 8168312: javac throws NPE if annotation processor is specified and module is declared in a file named arbitrarily Reviewed-by: jlahoda --- .../com/sun/tools/javac/code/Symtab.java | 14 ++- .../com/sun/tools/javac/comp/Modules.java | 8 +- ...nProcessingWithModuleInfoInWrongPlace.java | 99 +++++++++++++++++++ 3 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 langtools/test/tools/javac/modules/AnnotationProcessingWithModuleInfoInWrongPlace.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java index 40c9211b61d..202ca4e5dfe 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java @@ -383,7 +383,19 @@ public class Symtab { addRootPackageFor(unnamedModule); unnamedModule.enclosedPackages = unnamedModule.enclosedPackages.prepend(unnamedModule.unnamedPackage); - errModule = new ModuleSymbol(names.empty, null) { }; + errModule = new ModuleSymbol(names.empty, null) { + { + directives = List.nil(); + exports = List.nil(); + provides = List.nil(); + uses = List.nil(); + ModuleSymbol java_base = enterModule(names.java_base); + com.sun.tools.javac.code.Directive.RequiresDirective d = + new com.sun.tools.javac.code.Directive.RequiresDirective(java_base, + EnumSet.of(com.sun.tools.javac.code.Directive.RequiresFlag.MANDATED)); + requires = List.of(d); + } + }; addRootPackageFor(errModule); noModule = new ModuleSymbol(names.empty, null) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java index 2850e2506f4..b52af6545d6 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java @@ -293,8 +293,11 @@ public class Modules extends JCTree.Visitor { private void enterModule(JCCompilationUnit toplevel, ClassSymbol c, Set modules) { boolean isModuleInfo = toplevel.sourcefile.isNameCompatible("module-info", Kind.SOURCE); boolean isModuleDecl = toplevel.defs.nonEmpty() && toplevel.defs.head.hasTag(MODULEDEF); - if (isModuleInfo && isModuleDecl) { + if (isModuleDecl) { JCModuleDecl decl = (JCModuleDecl) toplevel.defs.head; + if (!isModuleInfo) { + log.error(decl.pos(), Errors.ModuleDeclSbInModuleInfoJava); + } Name name = TreeInfo.fullName(decl.qualId); ModuleSymbol sym; if (c != null) { @@ -330,9 +333,6 @@ public class Modules extends JCTree.Visitor { JCTree tree = toplevel.defs.isEmpty() ? toplevel : toplevel.defs.head; log.error(tree.pos(), Errors.ExpectedModule); } - } else if (isModuleDecl) { - JCTree tree = toplevel.defs.head; - log.error(tree.pos(), Errors.ModuleDeclSbInModuleInfoJava); } } diff --git a/langtools/test/tools/javac/modules/AnnotationProcessingWithModuleInfoInWrongPlace.java b/langtools/test/tools/javac/modules/AnnotationProcessingWithModuleInfoInWrongPlace.java new file mode 100644 index 00000000000..1a5e17842fd --- /dev/null +++ b/langtools/test/tools/javac/modules/AnnotationProcessingWithModuleInfoInWrongPlace.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2016, 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 8168312 + * @summary javac throws NPE if annotation processor is specified and module is declared in a file named arbitrarily + * @library /tools/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase + * @run main AnnotationProcessingWithModuleInfoInWrongPlace + */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Set; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.TypeElement; + +import toolbox.JavacTask; +import toolbox.Task; + +public class AnnotationProcessingWithModuleInfoInWrongPlace extends ModuleTestBase { + + public static void main(String... args) throws Exception { + new AnnotationProcessingWithModuleInfoInWrongPlace().runTests(); + } + + @Test + public void testModuleInfoInWrongPlace(Path base) throws Exception { + Path moduleSrc = base.resolve("module-src"); + Path m = moduleSrc.resolve("m"); + + Path classes = base.resolve("classes"); + + Files.createDirectories(classes); + + tb.writeJavaFiles(m, "module m {}"); + + Path mi = m.resolve("module-info.java"); + Path f = m.resolve("F.java"); + + tb.moveFile(mi, f); + + String log = new JavacTask(tb) + .options("-XDrawDiagnostics", + "--module-source-path", moduleSrc.toString(), + "-processor", AP.class.getName()) + .outdir(classes) + .files(findJavaFiles(moduleSrc)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + + if (!log.contains("F.java:1:1: compiler.err.module.decl.sb.in.module-info.java")) + throw new AssertionError("Unexpected output: " + log); + } + + @SupportedAnnotationTypes("*") + public static final class AP extends AbstractProcessor { + + @Override + public boolean process(Set annot, RoundEnvironment env) { + return false; + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + } +} From a556619f93569d870a2119ed24f0df2b62c7f89e Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Mon, 14 Nov 2016 10:13:38 -0800 Subject: [PATCH 43/54] 8168861: AnchorCertificates uses hardcoded password for cacerts keystore Reviewed-by: vinnie, mullan --- .../share/classes/sun/security/util/AnchorCertificates.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/sun/security/util/AnchorCertificates.java b/jdk/src/java.base/share/classes/sun/security/util/AnchorCertificates.java index 60edcc85d60..e260dd44ac0 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/AnchorCertificates.java +++ b/jdk/src/java.base/share/classes/sun/security/util/AnchorCertificates.java @@ -58,7 +58,7 @@ public class AnchorCertificates { try { cacerts = KeyStore.getInstance("JKS"); try (FileInputStream fis = new FileInputStream(f)) { - cacerts.load(fis, "changeit".toCharArray()); + cacerts.load(fis, null); certs = new HashSet<>(); Enumeration list = cacerts.aliases(); String alias; From 39b3b9cb3bac1c0878ad12622f4b0a1116d96bad Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Mon, 14 Nov 2016 13:32:15 -0800 Subject: [PATCH 44/54] 8168931: Few OCSP related test failed with "Response is unreliable: its validity interval is out-of-date" Reviewed-by: mullan --- .../sun/security/provider/certpath/RevocationChecker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/sun/security/provider/certpath/RevocationChecker.java b/jdk/src/java.base/share/classes/sun/security/provider/certpath/RevocationChecker.java index 85e596cb6c3..5fba1666119 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/RevocationChecker.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/RevocationChecker.java @@ -740,7 +740,7 @@ class RevocationChecker extends PKIXRevocationChecker { } response = OCSP.check(Collections.singletonList(certId), - responderURI, issuerInfo, responderCert, params.date(), + responderURI, issuerInfo, responderCert, null, ocspExtensions); } } catch (IOException e) { From 9b43eda24c57fb8c64db04b9b6dd4186c5cd00e6 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Mon, 14 Nov 2016 16:33:48 -0800 Subject: [PATCH 45/54] 8167967: javadoc should identify the ordinal value of enum constants Reviewed-by: jjg --- .../formats/html/AbstractMemberWriter.java | 2 +- .../formats/html/ConfigurationImpl.java | 2 - .../formats/html/ConstructorWriterImpl.java | 2 +- .../builders/AbstractMemberBuilder.java | 17 + .../builders/AnnotationTypeFieldBuilder.java | 39 +- .../AnnotationTypeRequiredMemberBuilder.java | 42 +- .../builders/ConstantsSummaryBuilder.java | 18 +- .../toolkit/builders/ConstructorBuilder.java | 40 +- .../toolkit/builders/EnumConstantBuilder.java | 38 +- .../toolkit/builders/FieldBuilder.java | 29 +- .../builders/MemberSummaryBuilder.java | 8 +- .../toolkit/builders/MethodBuilder.java | 38 +- .../toolkit/builders/PropertyBuilder.java | 35 +- .../internal/doclets/toolkit/util/Utils.java | 18 +- .../toolkit/util/VisibleMemberMap.java | 76 +- .../javadoc/doclet/testJavaFX/TestJavaFX.java | 29 +- .../doclet/testOrdering/TestOrdering.java | 1031 ++++++++++------- .../AnnoFieldTest.java} | 35 +- .../testOrdering/pkg5/AnnoOptionalTest.java | 31 + .../testOrdering/pkg5/AnnoRequiredTest.java | 31 + .../doclet/testOrdering/pkg5/CtorTest.java | 31 + .../doclet/testOrdering/pkg5/EnumTest.java | 31 + .../doclet/testOrdering/pkg5/FieldTest.java | 31 + .../doclet/testOrdering/pkg5/IntfTest.java | 31 + .../doclet/testOrdering/pkg5/MethodTest.java | 31 + .../testOrdering/pkg5/PropertyTest.java | 31 + 26 files changed, 990 insertions(+), 757 deletions(-) rename langtools/test/jdk/javadoc/doclet/testOrdering/{order/MethodOrder.java => pkg5/AnnoFieldTest.java} (63%) create mode 100644 langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoOptionalTest.java create mode 100644 langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoRequiredTest.java create mode 100644 langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/CtorTest.java create mode 100644 langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/EnumTest.java create mode 100644 langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/FieldTest.java create mode 100644 langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/IntfTest.java create mode 100644 langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/MethodTest.java create mode 100644 langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/PropertyTest.java diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java index e7c5385d937..b671ed16c3b 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java @@ -535,7 +535,7 @@ public abstract class AbstractMemberWriter { TypeElement superClass = utils.getSuperClass(typeElement); while (superClass != null) { - if (visibleMemberMap.hasMembersFor(superClass)) { + if (visibleMemberMap.hasMembers(superClass)) { liNav.addContent(getNavSummaryLink(superClass, true)); return; } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java index d2607ba41b8..3485be66d24 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java @@ -135,8 +135,6 @@ public class ConfigurationImpl extends Configuration { */ public String docrootparent = ""; - public boolean sortedMethodDetails = false; - /** * True if command line option "-nohelp" is used. Default value is false. */ diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java index be59ef815c9..612c2e0db06 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java @@ -72,7 +72,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter VisibleMemberMap visibleMemberMap = new VisibleMemberMap( typeElement, VisibleMemberMap.Kind.CONSTRUCTORS, configuration); - SortedSet constructors = visibleMemberMap.getMembersFor(typeElement); + List constructors = visibleMemberMap.getMembers(typeElement); for (Element constructor : constructors) { if (utils.isProtected(constructor) || utils.isPrivate(constructor)) { setFoundNonPubConstructor(true); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java index ee0dba08fee..3bc2b1a1939 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java @@ -25,6 +25,15 @@ package jdk.javadoc.internal.doclets.toolkit.builders; +import java.util.Collection; +import java.util.Comparator; +import java.util.Iterator; +import java.util.SortedSet; +import java.util.TreeSet; + +import javax.lang.model.element.Element; + +import jdk.javadoc.internal.doclets.formats.html.ConfigurationImpl; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.DocletException; @@ -42,6 +51,7 @@ import jdk.javadoc.internal.doclets.toolkit.DocletException; */ public abstract class AbstractMemberBuilder extends AbstractBuilder { + public final Comparator comparator; /** * Construct a SubBuilder. * @param context a context object, providing information used in this run @@ -49,6 +59,7 @@ public abstract class AbstractMemberBuilder extends AbstractBuilder { */ public AbstractMemberBuilder(Context context) { super(context); + comparator = utils.makeGeneralPurposeComparator(); } /** @@ -83,4 +94,10 @@ public abstract class AbstractMemberBuilder extends AbstractBuilder { * @return true if this subbuilder has anything to document */ public abstract boolean hasMembersToDocument(); + + public SortedSet asSortedSet(Collection members) { + SortedSet out = new TreeSet<>(comparator); + out.addAll(members); + return out; + } } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java index f8d020ab904..9026429b7c9 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java @@ -67,7 +67,7 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder { /** * The list of members being documented. */ - protected SortedSet members; + protected List members; /** * The index of the current member that is being documented at this point @@ -91,7 +91,7 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder { this.typeElement = typeElement; this.writer = writer; this.visibleMemberMap = new VisibleMemberMap(typeElement, memberType, configuration); - this.members = this.visibleMemberMap.getMembersFor(typeElement); + this.members = this.visibleMemberMap.getMembers(typeElement); } @@ -118,26 +118,6 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder { return "AnnotationTypeFieldDetails"; } - /** - * Returns a list of members that will be documented for the given class. - * This information can be used for doclet specific documentation - * generation. - * - * @param typeElement the TypeElement we want to check. - * @return a list of members that will be documented. - */ - public SortedSet members(TypeElement typeElement) { - return visibleMemberMap.getMembersFor(typeElement); - } - - /** - * Returns the visible member map for the members of this class. - * - * @return the visible member map for the members of this class. - */ - public VisibleMemberMap getVisibleMemberMap() { - return visibleMemberMap; - } /** * Returns whether or not there are members to document. @@ -145,7 +125,7 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder { */ @Override public boolean hasMembersToDocument() { - return members.size() > 0; + return !members.isEmpty(); } /** @@ -172,16 +152,19 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder { if (writer == null) { return; } - if (!members.isEmpty()) { + if (hasMembersToDocument()) { writer.addAnnotationFieldDetailsMarker(memberDetailsTree); - for (Element element : members) { - currentMember = element; + + Element lastElement = members.get(members.size() - 1); + for (Element member : members) { + currentMember = member; Content detailsTree = writer.getMemberTreeHeader(); writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree); - Content annotationDocTree = writer.getAnnotationDocTreeHeader(element, detailsTree); + Content annotationDocTree = writer.getAnnotationDocTreeHeader(currentMember, + detailsTree); buildChildren(node, annotationDocTree); detailsTree.addContent(writer.getAnnotationDoc( - annotationDocTree, currentMember == members.last())); + annotationDocTree, currentMember == lastElement)); memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); } } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java index 8f4a678c585..412f723ef16 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java @@ -68,7 +68,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { /** * The list of members being documented. */ - protected SortedSet members; + protected List members; /** * The index of the current member that is being documented at this point @@ -82,6 +82,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { * @param context the build context. * @param typeElement the class whose members are being documented. * @param writer the doclet specific writer. + * @param memberType the kind of member this builder processes. */ protected AnnotationTypeRequiredMemberBuilder(Context context, TypeElement typeElement, @@ -91,7 +92,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { this.typeElement = typeElement; this.writer = writer; this.visibleMemberMap = new VisibleMemberMap(typeElement, memberType, configuration); - this.members = this.visibleMemberMap.getMembersFor(typeElement); + this.members = this.visibleMemberMap.getMembers(typeElement); } @@ -101,6 +102,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { * @param context the build context. * @param typeElement the class whose members are being documented. * @param writer the doclet specific writer. + * @return an instance of this object */ public static AnnotationTypeRequiredMemberBuilder getInstance( Context context, TypeElement typeElement, @@ -118,34 +120,13 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { return "AnnotationTypeRequiredMemberDetails"; } - /** - * Returns a list of members that will be documented for the given class. - * This information can be used for doclet specific documentation - * generation. - * - * @param typeElement the {@link TypeElement} we want to check. - * @return a list of members that will be documented. - */ - public SortedSet members(TypeElement typeElement) { - return visibleMemberMap.getMembersFor(typeElement); - } - - /** - * Returns the visible member map for the members of this class. - * - * @return the visible member map for the members of this class. - */ - public VisibleMemberMap getVisibleMemberMap() { - return visibleMemberMap; - } - /** * Returns whether or not there are members to document. * @return whether or not there are members to document */ @Override public boolean hasMembersToDocument() { - return members.size() > 0; + return !members.isEmpty(); } /** @@ -165,24 +146,25 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { * * @param node the XML element that specifies which components to document * @param memberDetailsTree the content tree to which the documentation will be added + * @throws DocletException if an error occurs */ public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) throws DocletException { if (writer == null) { return; } - int size = members.size(); - if (size > 0) { + if (hasMembersToDocument()) { writer.addAnnotationDetailsMarker(memberDetailsTree); - for (Element element : members) { - currentMember = element; + Element lastMember = members.get((members.size() - 1)); + for (Element member : members) { + currentMember = member; Content detailsTree = writer.getMemberTreeHeader(); writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree); Content annotationDocTree = writer.getAnnotationDocTreeHeader( - element, detailsTree); + currentMember, detailsTree); buildChildren(node, annotationDocTree); detailsTree.addContent(writer.getAnnotationDoc( - annotationDocTree, currentMember == members.last())); + annotationDocTree, currentMember == lastMember)); memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); } } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java index 45eea2bc5b9..75a01fa5c73 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java @@ -275,7 +275,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder { private boolean hasConstantField (TypeElement typeElement) { VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(typeElement, VisibleMemberMap.Kind.FIELDS, configuration); - SortedSet fields = visibleMemberMapFields.getLeafClassMembers(); + List fields = visibleMemberMapFields.getLeafMembers(); for (Element f : fields) { VariableElement field = (VariableElement)f; if (field.getConstantValue() != null) { @@ -350,21 +350,21 @@ public class ConstantsSummaryBuilder extends AbstractBuilder { } /** - * Return the list of visible constant fields for the given TypeElement. - * @return the list of visible constant fields for the given TypeElement. + * Returns a set of visible constant fields for the given type. + * @return the set of visible constant fields for the given type. */ protected SortedSet members() { - SortedSet list = visibleMemberMapFields.getLeafClassMembers(); - list.addAll(visibleMemberMapEnumConst.getLeafClassMembers()); - SortedSet inclList = + List members = visibleMemberMapFields.getLeafMembers(); + members.addAll(visibleMemberMapEnumConst.getLeafMembers()); + SortedSet includes = new TreeSet<>(utils.makeGeneralPurposeComparator()); - for (Element element : list) { + for (Element element : members) { VariableElement member = (VariableElement)element; if (member.getConstantValue() != null) { - inclList.add(member); + includes.add(member); } } - return inclList; + return includes; } } } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java index 787ba257eb7..ee8076bb72f 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java @@ -59,7 +59,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { /** * The current constructor that is being documented at this point in time. */ - private ExecutableElement constructor; + private ExecutableElement currentConstructor; /** * The class whose constructors are being documented. @@ -79,7 +79,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { /** * The constructors being documented. */ - private final SortedSet constructors; + private final List constructors; /** * Construct a new ConstructorBuilder. @@ -99,7 +99,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { typeElement, VisibleMemberMap.Kind.CONSTRUCTORS, configuration); - constructors = visibleMemberMap.getMembersFor(typeElement); + constructors = visibleMemberMap.getMembers(typeElement); for (Element ctor : constructors) { if (utils.isProtected(ctor) || utils.isPrivate(ctor)) { writer.setFoundNonPubConstructor(true); @@ -136,18 +136,6 @@ public class ConstructorBuilder extends AbstractMemberBuilder { return !constructors.isEmpty(); } - /** - * Returns a list of constructors that will be documented for the given class. - * This information can be used for doclet specific documentation - * generation. - * - * @param typeElement the class - * @return a list of constructors that will be documented. - */ - public SortedSet members(TypeElement typeElement) { - return visibleMemberMap.getMembersFor(typeElement); - } - /** * Return the constructor writer for this builder. * @@ -168,17 +156,17 @@ public class ConstructorBuilder extends AbstractMemberBuilder { if (writer == null) { return; } - int size = constructors.size(); - if (size > 0) { + if (hasMembersToDocument()) { Content constructorDetailsTree = writer.getConstructorDetailsTreeHeader(typeElement, memberDetailsTree); - for (Element ctor : constructors) { - constructor = (ExecutableElement)ctor; - Content constructorDocTree = writer.getConstructorDocTreeHeader( - constructor, constructorDetailsTree); + + Element lastElement = constructors.get(constructors.size() - 1); + for (Element contructor : constructors) { + currentConstructor = (ExecutableElement)contructor; + Content constructorDocTree = writer.getConstructorDocTreeHeader(currentConstructor, constructorDetailsTree); buildChildren(node, constructorDocTree); constructorDetailsTree.addContent(writer.getConstructorDoc(constructorDocTree, - constructors.last().equals(constructor))); + currentConstructor == lastElement)); } memberDetailsTree.addContent( writer.getConstructorDetails(constructorDetailsTree)); @@ -192,7 +180,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { * @param constructorDocTree the content tree to which the documentation will be added */ public void buildSignature(XMLNode node, Content constructorDocTree) { - constructorDocTree.addContent(writer.getSignature(constructor)); + constructorDocTree.addContent(writer.getSignature(currentConstructor)); } /** @@ -202,7 +190,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { * @param constructorDocTree the content tree to which the documentation will be added */ public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) { - writer.addDeprecated(constructor, constructorDocTree); + writer.addDeprecated(currentConstructor, constructorDocTree); } /** @@ -214,7 +202,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { */ public void buildConstructorComments(XMLNode node, Content constructorDocTree) { if (!configuration.nocomment) { - writer.addComments(constructor, constructorDocTree); + writer.addComments(currentConstructor, constructorDocTree); } } @@ -225,6 +213,6 @@ public class ConstructorBuilder extends AbstractMemberBuilder { * @param constructorDocTree the content tree to which the documentation will be added */ public void buildTagInfo(XMLNode node, Content constructorDocTree) { - writer.addTags(constructor, constructorDocTree); + writer.addTags(currentConstructor, constructorDocTree); } } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java index 47ac296c5e9..ddb6619225e 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java @@ -67,9 +67,9 @@ public class EnumConstantBuilder extends AbstractMemberBuilder { private final EnumConstantWriter writer; /** - * The list of enum constants being documented. + * The set of enum constants being documented. */ - private final SortedSet enumConstants; + private final List enumConstants; /** * The current enum constant that is being documented at this point @@ -94,7 +94,7 @@ public class EnumConstantBuilder extends AbstractMemberBuilder { typeElement, VisibleMemberMap.Kind.ENUM_CONSTANTS, configuration); - enumConstants = visibleMemberMap.getMembersFor(typeElement); + enumConstants = visibleMemberMap.getMembers(typeElement); } /** @@ -118,27 +118,6 @@ public class EnumConstantBuilder extends AbstractMemberBuilder { return "EnumConstantDetails"; } - /** - * Returns a list of enum constants that will be documented for the given class. - * This information can be used for doclet specific documentation - * generation. - * - * @param typeElement the {@link TypeElement} we want to check. - * @return a list of enum constants that will be documented. - */ - public SortedSet members(TypeElement typeElement) { - return visibleMemberMap.getMembersFor(typeElement); - } - - /** - * Returns the visible member map for the enum constants of this class. - * - * @return the visible member map for the enum constants of this class. - */ - public VisibleMemberMap getVisibleMemberMap() { - return visibleMemberMap; - } - /** * Returns whether or not there are members to document. * @@ -146,7 +125,7 @@ public class EnumConstantBuilder extends AbstractMemberBuilder { */ @Override public boolean hasMembersToDocument() { - return enumConstants.size() > 0; + return !enumConstants.isEmpty(); } /** @@ -160,16 +139,17 @@ public class EnumConstantBuilder extends AbstractMemberBuilder { if (writer == null) { return; } - if (!enumConstants.isEmpty()) { + if (hasMembersToDocument()) { Content enumConstantsDetailsTree = writer.getEnumConstantsDetailsTreeHeader(typeElement, memberDetailsTree); - for (Element element : enumConstants) { - currentElement = (VariableElement)element; + Element lastElement = enumConstants.get(enumConstants.size() - 1); + for (Element enumConstant : enumConstants) { + currentElement = (VariableElement)enumConstant; Content enumConstantsTree = writer.getEnumConstantsTreeHeader(currentElement, enumConstantsDetailsTree); buildChildren(node, enumConstantsTree); enumConstantsDetailsTree.addContent(writer.getEnumConstants( - enumConstantsTree, currentElement.equals(enumConstants.last()))); + enumConstantsTree, currentElement == lastElement)); } memberDetailsTree.addContent( writer.getEnumConstantsDetails(enumConstantsDetailsTree)); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java index 09f6965f07f..ccb5671b9ab 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java @@ -69,7 +69,7 @@ public class FieldBuilder extends AbstractMemberBuilder { /** * The list of fields being documented. */ - private final SortedSet fields; + private final List fields; /** * The index of the current field that is being documented at this point @@ -95,7 +95,7 @@ public class FieldBuilder extends AbstractMemberBuilder { typeElement, VisibleMemberMap.Kind.FIELDS, configuration); - fields = visibleMemberMap.getLeafClassMembers(); + fields = visibleMemberMap.getLeafMembers(); } /** @@ -120,27 +120,6 @@ public class FieldBuilder extends AbstractMemberBuilder { return "FieldDetails"; } - /** - * Returns a list of fields that will be documented for the given class. - * This information can be used for doclet specific documentation - * generation. - * - * @param typeElement the {@link TypeElement} we want to check. - * @return a list of fields that will be documented. - */ - public SortedSet members(TypeElement typeElement) { - return visibleMemberMap.getMembersFor(typeElement); - } - - /** - * Returns the visible member map for the fields of this class. - * - * @return the visible member map for the fields of this class. - */ - public VisibleMemberMap getVisibleMemberMap() { - return visibleMemberMap; - } - /** * Returns whether or not there are members to document. * @@ -164,12 +143,14 @@ public class FieldBuilder extends AbstractMemberBuilder { } if (!fields.isEmpty()) { Content fieldDetailsTree = writer.getFieldDetailsTreeHeader(typeElement, memberDetailsTree); + + Element lastElement = fields.get(fields.size() - 1); for (Element element : fields) { currentElement = (VariableElement)element; Content fieldDocTree = writer.getFieldDocTreeHeader(currentElement, fieldDetailsTree); buildChildren(node, fieldDocTree); fieldDetailsTree.addContent(writer.getFieldDoc( - fieldDocTree, currentElement.equals(fields.last()))); + fieldDocTree, currentElement == lastElement)); } memberDetailsTree.addContent( writer.getFieldDetails(fieldDetailsTree)); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java index 713fc028e7c..5534abd0bd3 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java @@ -182,7 +182,9 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder { * @see VisibleMemberMap */ public SortedSet members(VisibleMemberMap.Kind type) { - return visibleMemberMaps.get(type).getLeafClassMembers(); + TreeSet out = new TreeSet<>(comparator); + out.addAll(visibleMemberMaps.get(type).getLeafMembers()); + return out; } /** @@ -336,7 +338,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder { */ private void buildSummary(MemberSummaryWriter writer, VisibleMemberMap visibleMemberMap, LinkedList summaryTreeList) { - SortedSet members = visibleMemberMap.getLeafClassMembers(); + SortedSet members = asSortedSet(visibleMemberMap.getLeafMembers()); if (!members.isEmpty()) { List tableContents = new LinkedList<>(); int counter = 0; @@ -492,7 +494,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder { if (inhclass == typeElement) { continue; } - SortedSet inhmembers = visibleMemberMap.getMembersFor(inhclass); + SortedSet inhmembers = asSortedSet(visibleMemberMap.getMembers(inhclass)); if (!inhmembers.isEmpty()) { Content inheritedTree = writer.getInheritedSummaryHeader(inhclass); Content linksTree = writer.getInheritedSummaryLinksTree(); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java index 7511bdad07d..ba0e88a287b 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java @@ -78,7 +78,7 @@ public class MethodBuilder extends AbstractMemberBuilder { /** * The methods being documented. */ - private final SortedSet methods; + private final List methods; /** @@ -98,7 +98,7 @@ public class MethodBuilder extends AbstractMemberBuilder { typeElement, VisibleMemberMap.Kind.METHODS, configuration); - methods = visibleMemberMap.getLeafClassMembers(); + methods = visibleMemberMap.getLeafMembers(); } /** @@ -123,27 +123,6 @@ public class MethodBuilder extends AbstractMemberBuilder { return "MethodDetails"; } - /** - * Returns a list of methods that will be documented for the given class. - * This information can be used for doclet specific documentation - * generation. - * - * @param typeElement the {@link TypeElement} we want to check. - * @return a list of methods that will be documented. - */ - public SortedSet members(TypeElement typeElement) { - return visibleMemberMap.getMembersFor(typeElement); - } - - /** - * Returns the visible member map for the methods of this class. - * - * @return the visible member map for the methods of this class. - */ - public VisibleMemberMap getVisibleMemberMap() { - return visibleMemberMap; - } - /** * {@inheritDoc} */ @@ -163,18 +142,17 @@ public class MethodBuilder extends AbstractMemberBuilder { if (writer == null) { return; } - if (!methods.isEmpty()) { + if (hasMembersToDocument()) { Content methodDetailsTree = writer.getMethodDetailsTreeHeader(typeElement, memberDetailsTree); - Set methodDetailSet = ((ConfigurationImpl)configuration).sortedMethodDetails - ? methods - : visibleMemberMap.getLeafClassMembersSourceOrder(); - for (Element e : methodDetailSet) { - currentMethod = (ExecutableElement) e; + + Element lastElement = methods.get(methods.size() - 1); + for (Element method : methods) { + currentMethod = (ExecutableElement)method; Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod, methodDetailsTree); buildChildren(node, methodDocTree); methodDetailsTree.addContent(writer.getMethodDoc( - methodDocTree, currentMethod == methods.last())); + methodDocTree, currentMethod == lastElement)); } memberDetailsTree.addContent(writer.getMethodDetails(methodDetailsTree)); } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java index 68af2e3447b..986924f61fb 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java @@ -69,7 +69,7 @@ public class PropertyBuilder extends AbstractMemberBuilder { /** * The list of properties being documented. */ - private final SortedSet properties; + private final List properties; /** * The index of the current property that is being documented at this point @@ -95,7 +95,7 @@ public class PropertyBuilder extends AbstractMemberBuilder { typeElement, VisibleMemberMap.Kind.PROPERTIES, configuration); - properties = visibleMemberMap.getMembersFor(typeElement); + properties = visibleMemberMap.getMembers(typeElement); } /** @@ -120,27 +120,6 @@ public class PropertyBuilder extends AbstractMemberBuilder { return "PropertyDetails"; } - /** - * Returns a list of properties that will be documented for the given class. - * This information can be used for doclet specific documentation - * generation. - * - * @param typeElement the {@link TypeElement} we want to check. - * @return a list of properties that will be documented. - */ - public SortedSet members(TypeElement typeElement) { - return visibleMemberMap.getMembersFor(typeElement); - } - - /** - * Returns the visible member map for the properties of this class. - * - * @return the visible member map for the properties of this class. - */ - public VisibleMemberMap getVisibleMemberMap() { - return visibleMemberMap; - } - /** * Returns whether or not there are members to document. * @@ -162,17 +141,17 @@ public class PropertyBuilder extends AbstractMemberBuilder { if (writer == null) { return; } - int size = properties.size(); - if (size > 0) { + if (hasMembersToDocument()) { Content propertyDetailsTree = writer.getPropertyDetailsTreeHeader(typeElement, memberDetailsTree); - for (Element e : properties) { - currentProperty = (ExecutableElement) e; + Element lastElement = properties.get(properties.size() - 1); + for (Element property : properties) { + currentProperty = (ExecutableElement)property; Content propertyDocTree = writer.getPropertyDocTreeHeader(currentProperty, propertyDetailsTree); buildChildren(node, propertyDocTree); propertyDetailsTree.addContent(writer.getPropertyDoc( - propertyDocTree, currentProperty == properties.last())); + propertyDocTree, currentProperty == lastElement)); } memberDetailsTree.addContent( writer.getPropertyDetails(propertyDetailsTree)); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java index e23cf65983a..7ba231bac15 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java @@ -25,7 +25,6 @@ package jdk.javadoc.internal.doclets.toolkit.util; -import java.io.IOException; import java.lang.annotation.Documented; import java.lang.ref.SoftReference; import java.text.CollationKey; @@ -77,9 +76,7 @@ import com.sun.source.util.DocTrees; import com.sun.source.util.TreePath; import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo; import jdk.javadoc.internal.doclets.toolkit.Configuration; -import jdk.javadoc.internal.doclets.toolkit.DocletException; import jdk.javadoc.internal.doclets.toolkit.Messages; -import jdk.javadoc.internal.doclets.toolkit.Resources; import jdk.javadoc.internal.doclets.toolkit.WorkArounds; import static javax.lang.model.element.ElementKind.*; @@ -258,14 +255,6 @@ public class Utils { return getEnclosingTypeElement(e) == null || isStatic(e); } - public boolean matches(Element e1, Element e2) { - if (isExecutableElement(e1) && isExecutableElement(e1)) { - return executableMembersEqual((ExecutableElement)e1, (ExecutableElement)e2); - } else { - return e1.getSimpleName().equals(e2.getSimpleName()); - } - } - /** * Copy doc-files directory and its contents from the source * package directory to the generated documentation directory. @@ -2161,6 +2150,13 @@ public class Utils { return convertToExecutableElement(getItems(e, false, METHOD)); } + public int getOrdinalValue(VariableElement member) { + if (member == null || member.getKind() != ENUM_CONSTANT) { + throw new IllegalArgumentException("must be an enum constant: " + member); + } + return member.getEnclosingElement().getEnclosedElements().indexOf(member); + } + public long getLineNumber(Element e) { TreePath path = getTreePath(e); if (path == null) { // maybe null if synthesized diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java index 6fbae159bf1..08e07514964 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java @@ -220,48 +220,36 @@ public class VisibleMemberMap { } /** - * Return the visible members of the class being mapped. Also append at the - * end of the list members that are inherited by inaccessible parents. We - * document these members in the child because the parent is not documented. + * Returns a list of visible enclosed members of the type being mapped. + * This list may also contain appended members, inherited by inaccessible + * super types. These members are documented in the subtype when the + * super type is not documented. * - * @param configuration the current configuration of the doclet. + * @return a list of visible enclosed members */ - public SortedSet getLeafClassMembers() { - SortedSet result = getMembersFor(typeElement); - result.addAll(getInheritedPackagePrivateMethods()); - return result; - } - public Set getLeafClassMembersSourceOrder() { - Set result = new LinkedHashSet<>(classMap.get(typeElement).members); + public List getLeafMembers() { + List result = new ArrayList<>(); + result.addAll(classMap.get(typeElement).members); result.addAll(getInheritedPackagePrivateMethods()); return result; } /** - * Retrn the list of members for the given class. + * Returns a list of enclosed members for the given type. * - * @param typeElement the class to retrieve the list of visible members for. + * @param typeElement the given type * - * @return the list of members for the given class. + * @return a list of enclosed members */ - public SortedSet getMembersFor(TypeElement typeElement) { - return asSortedSet(classMap.get(typeElement).members); + public List getMembers(TypeElement typeElement) { + return classMap.get(typeElement).members; } - public boolean hasMembersFor(TypeElement typeElement) { + public boolean hasMembers(TypeElement typeElement) { return !classMap.get(typeElement).members.isEmpty(); } - private SortedSet asSortedSet(Collection in) { - if (in == null) { - return Collections.emptySortedSet(); - } - TreeSet out = new TreeSet<>(comparator); - out.addAll(in); - return out; - } - private void fillMemberLevelMap(List list, String level) { for (Element element : list) { Object key = getMemberKey(element); @@ -318,9 +306,9 @@ public class VisibleMemberMap { private final TypeElement typeElement; /** - * List of inherited members from the mapping class. + * List of members from the mapping class. */ - private Set members = new LinkedHashSet<>(); + private List members = null; /** * Level/Depth of inheritance. @@ -379,23 +367,23 @@ public class VisibleMemberMap { * Adjust member-level-map, class-map. */ private void addMembers(TypeElement fromClass) { - List classMembers = getClassMembers(fromClass, true); - List incllist = new ArrayList<>(); - for (Element element : classMembers) { - if (!found(members, element)) { - if (memberIsVisible(element)) { - if (!isOverridden(element, level)) { - if (!utils.isHidden(element)) { - incllist.add(element); - } + List result = new ArrayList<>(); + for (Element element : getClassMembers(fromClass, true)) { + if (memberIsVisible(element)) { + if (!isOverridden(element, level)) { + if (!utils.isHidden(element)) { + result.add(element); } } } } - if (!incllist.isEmpty()) { + if (members != null) { + throw new AssertionError("members should not be null"); + } + members = Collections.unmodifiableList(result); + if (!members.isEmpty()) { noVisibleMembers = false; } - members.addAll(incllist); fillMemberLevelMap(getClassMembers(fromClass, false), level); } @@ -513,16 +501,6 @@ public class VisibleMemberMap { return targetMembers; } - private boolean found(Iterable list, Element elem) { - for (Element pgmelem : list) { - if (utils.matches(pgmelem, elem)) { - return true; - } - } - return false; - } - - /** * Is member overridden? The member is overridden if it is found in the * same level hierarchy e.g. member at level "11" overrides member at diff --git a/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java b/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java index cc8af164a63..bb9c951876b 100644 --- a/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java +++ b/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 + * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 8167967 * @summary Test of the JavaFX doclet features. * @author jvalenta * @library ../lib @@ -163,10 +163,7 @@ public class TestJavaFX extends JavadocTester { "pkg2"); checkExit(Exit.OK); checkOutput("pkg2/Test.html", true, - "
  • \n" - + "\n" - + "\n" - + "

    Property Detail

    \n" + "

    Property Detail

    \n" + "\n" + "\n" + "\n" @@ -176,27 +173,27 @@ public class TestJavaFX extends JavadocTester { + "
    public java.lang.Object betaProperty
    \n" + "
  • \n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "
      \n" + "
    • \n" + + "

      gamma

      \n" + + "
      public final java.util.List<java.lang.String> gammaProperty
      \n" + + "
    • \n" + + "
    \n" + + "\n" + + "\n" + + "\n" + + "
      \n" + + "
    • \n" + "

      delta

      \n" + "
      public final java.util.List<"
                       + "java.util.Set<? super java.lang.Object>> deltaProperty
      \n" + "
    • \n" + "
    \n" - + "\n" - + "\n" - + "\n" - + "
      \n" - + "
    • \n" - + "

      gamma

      \n" - + "
      public final java.util.List<"
      -                + "java.lang.String> gammaProperty
      \n" + "
    • \n" - + "
    \n" - + ""); + + ""); } /* diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/TestOrdering.java b/langtools/test/jdk/javadoc/doclet/testOrdering/TestOrdering.java index 9ffac254c93..19626d84d10 100644 --- a/langtools/test/jdk/javadoc/doclet/testOrdering/TestOrdering.java +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/TestOrdering.java @@ -23,9 +23,8 @@ /* * @test - * @bug 8039410 8042601 8042829 8049393 8050031 8155061 8155995 + * @bug 8039410 8042601 8042829 8049393 8050031 8155061 8155995 8167967 * @summary test to determine if members are ordered correctly - * @author ksrini * @library ../lib/ * @modules jdk.javadoc/jdk.javadoc.internal.tool * @build JavadocTester @@ -51,492 +50,640 @@ public class TestOrdering extends JavadocTester { @Test void testUnnamedPackagesForClassUse() { - javadoc("-d", "out", - "-sourcepath", testSrc, - "-use", - testSrc("C.java"), testSrc("UsedInC.java")); - checkExit(Exit.OK); - checkExecutableMemberOrdering("class-use/UsedInC.html"); + new UnnamedPackageForClassUseTest(this).run(); } @Test void testNamedPackagesForClassUse() { - javadoc("-d", "out-1", - "-sourcepath", testSrc, - "-use", - "pkg1"); - checkExit(Exit.OK); - checkClassUseOrdering("pkg1/class-use/UsedClass.html"); - checkOrder("pkg1/class-use/UsedClass.html", expectedClassUseMethodOrdering); - checkOrder("pkg1/class-use/UsedClass.html", expectedClassUseWithTypeParams); - checkOrder("pkg1/class-use/UsedClass.html", expectedInnerClassContructors); - checkOrder("pkg1/ImplementsOrdering.html", expectedImplementsOrdering); - checkOrder("pkg1/OverrideOrdering.html", expectedOverrideOrdering); - checkOrder("allclasses-noframe.html", expectedAllClasses); - checkOrder("allclasses-frame.html", expectedAllClasses); + new NamedPackagesForClassUseTest(this).run(); } - enum ListOrder { NONE, REVERSE, SHUFFLE }; - /* - * By default we do not shuffle the input list, in order to keep the list deterministic, - * and the test predictable. However, we can turn on the stress mode, by setting the following - * property if required. - */ - static final ListOrder STRESS_MODE = Boolean.getBoolean("TestOrder.STRESS") - ? ListOrder.SHUFFLE - : ListOrder.REVERSE; - - /* - * Controls the number of sibling packages, pkg0, pkg1, pkg2, ..... - */ - static final int MAX_PACKAGES = 4; - - /* - * Controls the number of children packages, pkg0, pkg0.pkg, pkg0.pkg.pkg, ..... - * Note: having too long a depth (> 256 chars on Windows), will likely lead to - * cause problems with automated build and test systems. - */ - static final int MAX_SUBPACKAGES_DEPTH = 4; @Test void testIndexOrdering() throws IOException { - final String clsname = "Add"; - List cmdArgs = new ArrayList(); - cmdArgs.add("-d"); - cmdArgs.add("out-2"); - cmdArgs.add("-sourcepath"); - cmdArgs.add("src"); - cmdArgs.add("-package"); - System.out.println("STRESS_MODE: " + STRESS_MODE); - emitFile(null, clsname, STRESS_MODE); - for (int width = 0 ; width < MAX_PACKAGES ; width++) { - String wpkgname = "add" + width; - String dpkgname = wpkgname; - emitFile(wpkgname, clsname, ListOrder.NONE); // list as-is - cmdArgs.add(wpkgname); - for (int depth = 1 ; depth < MAX_SUBPACKAGES_DEPTH ; depth++) { - dpkgname = dpkgname + ".add"; - emitFile(dpkgname, clsname, STRESS_MODE); - cmdArgs.add(dpkgname); - } - } - File srcDir = new File(new File("."), "src"); - cmdArgs.add(new File(srcDir, clsname + ".java").getPath()); - javadoc(cmdArgs.toArray(new String[cmdArgs.size()])); - checkExit(Exit.OK); - checkOrder("index-all.html", composeTestVectors()); - checkOrder("add0/add/package-tree.html", expectedPackageTreeOrdering); - checkOrder("overview-tree.html", expectedOverviewOrdering); - checkOrder("overview-frame.html", expectedOverviewFrameOrdering); + new IndexOrderingTest(this).run(); } @Test void testIndexTypeClustering() { - javadoc("-d", "out-3", - "-sourcepath", testSrc("src-2"), - "-use", - "a", - "b", - "e", - "something"); - checkOrder("index-all.html", typeTestVectors); - checkExit(Exit.OK); + new IndexTypeClusteringTest(this).run(); } @Test - void testMethodDetailOrdering() { - javadoc("-d", "out-4", - "-sourcepath", testSrc(new File(".").getPath()), - "order" - ); - checkOrder("order/MethodOrder.html", methodSourceOrderVectors); - checkExit(Exit.OK); + void testTypeElementMemberOrdering() { + new TypeElementMemberOrderingTest(this).run(); } - String[] methodSourceOrderVectors = { - "
    public void d()
    \n" + - "
    Method d.\n" + - " Second line.
    ", - "
    public void b()
    \n" + - "
    Method b.\n" + - " Second line.
    ", - "
    public void c()
    \n" + - "
    Method c.\n" + - " Second line.
    ", - "
    public void a()
    \n" + - "
    Method a.\n" + - " Second line.
    " - }; + static class UnnamedPackageForClassUseTest { + final JavadocTester tester; - String[] typeTestVectors = { - "something - package something", - "something - Class in", - "something - Enum in", - "something - Interface in", - "something - Annotation Type in", - "something - Variable in class", - "something() - Constructor", - "something() - Method in class a. - Method in class a. - Method in class something. testList = new ArrayList<>(); - - testList.addAll(Arrays.asList(expectedPackageOrdering)); - for (String x : expectedEnumOrdering) { - testList.add(x.replace("REPLACE_ME", "<Unnamed>")); - for (int i = 0; i < MAX_PACKAGES; i++) { - String wpkg = "add" + i; - testList.add(wpkg + "/" + x.replace("REPLACE_ME", - wpkg)); - String dpkg = wpkg; - for (int j = 1; j < MAX_SUBPACKAGES_DEPTH; j++) { - dpkg = dpkg + "/" + "add"; - testList.add(dpkg + "/" + x.replace("REPLACE_ME", - pathToPackage(dpkg))); - } - } + UnnamedPackageForClassUseTest(JavadocTester tester) { + this.tester = tester; } - testList.addAll(Arrays.asList(expectedFieldOrdering)); - - for (String x : expectedMethodOrdering) { - testList.add(x); - for (int i = 0; i < MAX_PACKAGES; i++) { - String wpkg = "add" + i; - testList.add(wpkg + "/" + x); - String dpkg = wpkg; - for (int j = 1; j < MAX_SUBPACKAGES_DEPTH; j++) { - dpkg = dpkg + "/" + "add"; - testList.add(dpkg + "/" + x); - } - } + void run() { + tester.javadoc("-d", "out", + "-sourcepath", testSrc, + "-use", + tester.testSrc("C.java"), tester.testSrc("UsedInC.java")); + tester.checkExit(Exit.OK); + checkExecutableMemberOrdering("class-use/UsedInC.html"); } - return testList.toArray(new String[testList.size()]); - } - - void checkExecutableMemberOrdering(String usePage) { - String contents = readFile(usePage); - // check constructors - checking("constructors"); - int idx1 = contents.indexOf("C.html#C-UsedInC"); - int idx2 = contents.indexOf("C.html#C-UsedInC-int"); - int idx3 = contents.indexOf("C.html#C-UsedInC-java.lang.String"); - if (idx1 == -1 || idx2 == -1 || idx3 == -1) { - failed("ctor strings not found"); - } else if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) { - failed("ctor strings are out of order"); - } else - passed("ctor strings are in order"); - - // check methods - checking("methods"); - idx1 = contents.indexOf("C.html#ymethod-int"); - idx2 = contents.indexOf("C.html#ymethod-java.lang.String"); - if (idx1 == -1 || idx2 == -1) { - failed("#ymethod strings not found"); - } else if (idx1 > idx2) { - failed("#ymethod strings are out of order"); - } else - passed("Executable Member Ordering: OK"); - } - - void checkClassUseOrdering(String usePage) { - checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zfield"); - checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#fieldInC#ITERATION#"); - checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zmethod-pkg1.UsedClass"); - checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#methodInC#ITERATION#"); - } - - void checkClassUseOrdering(String usePage, String searchString) { - String contents = readFile(usePage); - int lastidx = 0; - System.out.println("testing for " + searchString); - for (int i = 1; i < 5; i++) { - String s = searchString.replaceAll("#ITERATION#", Integer.toString(i)); - checking(s); - int idx = contents.indexOf(s); - if (idx < lastidx) { - failed(s + ", member ordering error, last:" + lastidx + ", got:" + idx); + void checkExecutableMemberOrdering(String usePage) { + String contents = tester.readFile(usePage); + // check constructors + tester.checking("constructors"); + int idx1 = contents.indexOf("C.html#C-UsedInC"); + int idx2 = contents.indexOf("C.html#C-UsedInC-int"); + int idx3 = contents.indexOf("C.html#C-UsedInC-java.lang.String"); + if (idx1 == -1 || idx2 == -1 || idx3 == -1) { + tester.failed("ctor strings not found"); + } else if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) { + tester.failed("ctor strings are out of order"); } else { - passed("\tlast: " + lastidx + " got:" + idx); + tester.passed("ctor strings are in order"); + } + + // check methods + tester.checking("methods"); + idx1 = contents.indexOf("C.html#ymethod-int"); + idx2 = contents.indexOf("C.html#ymethod-java.lang.String"); + if (idx1 == -1 || idx2 == -1) { + tester.failed("#ymethod strings not found"); + } else if (idx1 > idx2) { + tester.failed("#ymethod strings are out of order"); + } else { + tester.passed("Executable Member Ordering: OK"); } - lastidx = idx; } } - static String[] contents = { - "public add ADDADD;", - "public add AddAdd;", - "public add addadd;", - "public enum add {add, ADD, addd, ADDD};", - "public enum ADD {ADD, add, addd, ADDD};", - "public void add(){}", - "public void add(double d){}", - "public void add(int i, float f){}", - "public void add(float f, int i){}", - "public void add(double d, byte b){}", - "public Double add(Double d) {return (double) 22/7;}", - "public double add(double d1, double d2) {return d1 + d2;}", - "public double add(double d1, Double d2) {return d1 + d2;}", - "public Float add(float f) {return (float) 22/7;}", - "public void add(int i){}", - "public int add(Integer i) {return 0;}" - }; + static class NamedPackagesForClassUseTest { + final JavadocTester tester; - void emitFile(String pkgname, String clsname, ListOrder order) throws IOException { - File srcDir = new File("src"); - File outDir = pkgname == null - ? srcDir - : new File(srcDir, pkgname.replace(".", File.separator)); - File outFile = new File(outDir, clsname + ".java"); - outDir.mkdirs(); - List scratch = new ArrayList<>(Arrays.asList(contents)); - switch (order) { - case SHUFFLE: - Collections.shuffle(scratch); - break; - case REVERSE: - Collections.reverse(scratch); - break; - default: + NamedPackagesForClassUseTest(JavadocTester tester) { + this.tester = tester; + } + + public void run() { + tester.javadoc("-d", "out-1", + "-sourcepath", tester.testSrc, + "-use", + "pkg1"); + tester.checkExit(Exit.OK); + + checkClassUseOrdering("pkg1/class-use/UsedClass.html"); + + tester.checkOrder("pkg1/class-use/UsedClass.html", + "../../pkg1/MethodOrder.html#m--", + "../../pkg1/MethodOrder.html#m-byte:A-", + "../../pkg1/MethodOrder.html#m-double-", + "../../pkg1/MethodOrder.html#m-double-double-", + "../../pkg1/MethodOrder.html#m-double-java.lang.Double-", + "../../pkg1/MethodOrder.html#m-int-", + "../../pkg1/MethodOrder.html#m-int-int-", + "../../pkg1/MethodOrder.html#m-int-java.lang.Integer-", + "../../pkg1/MethodOrder.html#m-long-", + "../../pkg1/MethodOrder.html#m-long-long-", + "../../pkg1/MethodOrder.html#m-long-java.lang.Long-", + "../../pkg1/MethodOrder.html#m-long-java.lang.Long...-", + "../../pkg1/MethodOrder.html#m-java.lang.Double-", + "../../pkg1/MethodOrder.html#m-java.lang.Double-double-", + "../../pkg1/MethodOrder.html#m-java.lang.Double-java.lang.Double-", + "../../pkg1/MethodOrder.html#m-java.lang.Integer-", + "../../pkg1/MethodOrder.html#m-java.lang.Integer-int-", + "../../pkg1/MethodOrder.html#m-java.lang.Integer-java.lang.Integer-", + "../../pkg1/MethodOrder.html#m-java.lang.Object:A-", + "../../pkg1/MethodOrder.html#m-java.util.ArrayList-", + "../../pkg1/MethodOrder.html#m-java.util.Collection-", + "../../pkg1/MethodOrder.html#m-java.util.List-"); + + tester.checkOrder("pkg1/class-use/UsedClass.html", + "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-", + "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass-", + "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass:A-", + "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-java.lang.String-"); + + tester.checkOrder("pkg1/class-use/UsedClass.html", + "../../pkg1/A.html#A-pkg1.UsedClass-", + "../../pkg1/B.A.html#A-pkg1.UsedClass-", + "../../pkg1/B.html#B-pkg1.UsedClass-", + "../../pkg1/A.C.html#C-pkg1.UsedClass-java.lang.Object:A-", + "../../pkg1/A.C.html#C-pkg1.UsedClass-java.util.Collection-", + "../../pkg1/A.C.html#C-pkg1.UsedClass-java.util.List-"); + + tester.checkOrder("pkg1/ImplementsOrdering.html", + "
    close in interface java.lang.AutoCloseable
    ", + "
    close in interface java.nio.channels.Channel
    ", + "
    close in interface java.io.Closeable
    "); + + tester.checkOrder("pkg1/OverrideOrdering.html", + "
    iterator in interface java.util.Collection<", + "
    iterator in interface java.lang.Iterable<"); + + tester.checkOrder("allclasses-noframe.html", + "pkg1/A.html\" title=\"class in pkg1", + "pkg1/A.C.html\" title=\"class in pkg1", + "pkg1/B.html\" title=\"class in pkg1", + "pkg1/B.A.html\" title=\"class in pkg1", + "pkg1/C1.html\" title=\"class in pkg1", + "pkg1/C2.html\" title=\"class in pkg1", + "pkg1/C3.html\" title=\"class in pkg1", + "pkg1/C4.html\" title=\"class in pkg1", + "pkg1/ImplementsOrdering.html\" title=\"interface in pkg1", + "pkg1/MethodOrder.html\" title=\"class in pkg1", + "pkg1/OverrideOrdering.html\" title=\"class in pkg1", + "pkg1/UsedClass.html\" title=\"class in pkg1"); + + tester.checkOrder("allclasses-frame.html", + "pkg1/A.html\" title=\"class in pkg1", + "pkg1/A.C.html\" title=\"class in pkg1", + "pkg1/B.html\" title=\"class in pkg1", + "pkg1/B.A.html\" title=\"class in pkg1", + "pkg1/C1.html\" title=\"class in pkg1", + "pkg1/C2.html\" title=\"class in pkg1", + "pkg1/C3.html\" title=\"class in pkg1", + "pkg1/C4.html\" title=\"class in pkg1", + "pkg1/ImplementsOrdering.html\" title=\"interface in pkg1", + "pkg1/MethodOrder.html\" title=\"class in pkg1", + "pkg1/OverrideOrdering.html\" title=\"class in pkg1", + "pkg1/UsedClass.html\" title=\"class in pkg1"); + } + + void checkClassUseOrdering(String usePage) { + checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zfield"); + checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#fieldInC#ITERATION#"); + checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zmethod-pkg1.UsedClass"); + checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#methodInC#ITERATION#"); + } + + void checkClassUseOrdering(String usePage, String searchString) { + String contents = tester.readFile(usePage); + int lastidx = 0; + System.out.println("testing for " + searchString); + for (int i = 1; i < 5; i++) { + String s = searchString.replaceAll("#ITERATION#", Integer.toString(i)); + tester.checking(s); + int idx = contents.indexOf(s); + if (idx < lastidx) { + tester.failed(s + ", member ordering error, last:" + lastidx + ", got:" + idx); + } else { + tester.passed("\tlast: " + lastidx + " got:" + idx); + } + lastidx = idx; + } + } + } + + static class IndexOrderingTest { + private final JavadocTester tester; + + IndexOrderingTest(JavadocTester tester) { + this.tester = tester; + } + + enum ListOrder { + NONE, REVERSE, SHUFFLE + }; + + /* + * By default we do not shuffle the input list, in order to keep the list deterministic, + * and the test predictable. However, we can turn on the stress mode, by setting the following + * property if required. + */ + static final ListOrder STRESS_MODE = Boolean.getBoolean("TestOrder.STRESS") + ? ListOrder.SHUFFLE + : ListOrder.REVERSE; + + /* + * Controls the number of children packages, pkg0, pkg0.pkg, pkg0.pkg.pkg, ..... + * Note: having too long a depth (> 256 chars on Windows), will likely lead to + * cause problems with automated build and test systems. + */ + static final int MAX_SUBPACKAGES_DEPTH = 4; + + /* + * Controls the number of sibling packages, pkg0, pkg1, pkg2, ..... + */ + static final int MAX_PACKAGES = 4; + + static String[] contents = { + "public add ADDADD;", + "public add AddAdd;", + "public add addadd;", + "public enum add {add, ADD, addd, ADDD};", + "public enum ADD {ADD, add, addd, ADDD};", + "public void add(){}", + "public void add(double d){}", + "public void add(int i, float f){}", + "public void add(float f, int i){}", + "public void add(double d, byte b){}", + "public Double add(Double d) {return (double) 22/7;}", + "public double add(double d1, double d2) {return d1 + d2;}", + "public double add(double d1, Double d2) {return d1 + d2;}", + "public Float add(float f) {return (float) 22/7;}", + "public void add(int i){}", + "public int add(Integer i) {return 0;}" + }; + + static String expectedEnumOrdering[] = { + "Add.add.html\" title=\"enum in REPLACE_ME\"", + "Add.ADD.html\" title=\"enum in REPLACE_ME\"" + }; + + static String expectedFieldOrdering[] = { + "Add.html#addadd\"", + "add0/add/add/add/Add.html#addadd\"", + "add0/add/add/Add.html#addadd\"", + "add0/add/Add.html#addadd\"", + "add0/Add.html#addadd\"", + "add1/add/add/add/Add.html#addadd\"", + "add1/add/add/Add.html#addadd\"", + "add1/add/Add.html#addadd\"", + "add1/Add.html#addadd\"", + "add2/add/add/add/Add.html#addadd\"", + "add2/add/add/Add.html#addadd\"", + "add2/add/Add.html#addadd\"", + "add2/Add.html#addadd\"", + "add3/add/add/add/Add.html#addadd\"", + "add3/add/add/Add.html#addadd\"", + "add3/add/Add.html#addadd\"", + "add3/Add.html#addadd\"", + "Add.html#AddAdd\"", + "add0/add/add/add/Add.html#AddAdd\"", + "add0/add/add/Add.html#AddAdd\"", + "add0/add/Add.html#AddAdd\"", + "add0/Add.html#AddAdd\"", + "add1/add/add/add/Add.html#AddAdd\"", + "add1/add/add/Add.html#AddAdd\"", + "add1/add/Add.html#AddAdd\"", + "add1/Add.html#AddAdd\"", + "add2/add/add/add/Add.html#AddAdd\"", + "add2/add/add/Add.html#AddAdd\"", + "add2/add/Add.html#AddAdd\"", + "add2/Add.html#AddAdd\"", + "add3/add/add/add/Add.html#AddAdd\"", + "add3/add/add/Add.html#AddAdd\"", + "add3/add/Add.html#AddAdd\"", + "add3/Add.html#AddAdd\"", + "Add.html#ADDADD\"", + "add0/add/add/add/Add.html#ADDADD\"", + "add0/add/add/Add.html#ADDADD\"", + "add0/add/Add.html#ADDADD\"", + "add0/Add.html#ADDADD\"", + "add1/add/add/add/Add.html#ADDADD\"", + "add1/add/add/Add.html#ADDADD\"", + "add1/add/Add.html#ADDADD\"", + "add1/Add.html#ADDADD\"", + "add2/add/add/add/Add.html#ADDADD\"", + "add2/add/add/Add.html#ADDADD\"", + "add2/add/Add.html#ADDADD\"", + "add2/Add.html#ADDADD\"", + "add3/add/add/add/Add.html#ADDADD\"", + "add3/add/add/Add.html#ADDADD\"", + "add3/add/Add.html#ADDADD\"", + "add3/Add.html#ADDADD\"" + }; + + static String expectedMethodOrdering[] = { + "Add.html#add--", + "Add.html#add-double-", + "Add.html#add-double-byte-", + "Add.html#add-double-double-", + "Add.html#add-double-java.lang.Double-", + "Add.html#add-float-", + "Add.html#add-float-int-", + "Add.html#add-int-", + "Add.html#add-int-float-", + "Add.html#add-java.lang.Double-", + "Add.html#add-java.lang.Integer-" + }; + + static String expectedPackageOrdering[] = { + "\"add0/package-summary.html\">add0 - package add0", + "\"add0/add/package-summary.html\">add0.add - package add0.add", + "\"add0/add/add/package-summary.html\">add0.add.add - package add0.add.add", + "\"add0/add/add/add/package-summary.html\">add0.add.add.add - package add0.add.add.add", + "\"add1/package-summary.html\">add1 - package add1", + "\"add1/add/package-summary.html\">add1.add - package add1.add", + "\"add1/add/add/package-summary.html\">add1.add.add - package add1.add.add", + "\"add1/add/add/add/package-summary.html\">add1.add.add.add - package add1.add.add.add", + "\"add2/package-summary.html\">add2 - package add2", + "\"add2/add/package-summary.html\">add2.add - package add2.add", + "\"add2/add/add/package-summary.html\">add2.add.add - package add2.add.add", + "\"add2/add/add/add/package-summary.html\">add2.add.add.add - package add2.add.add.add", + "\"add3/package-summary.html\">add3 - package add3", + "\"add3/add/package-summary.html\">add3.add - package add3.add", + "\"add3/add/add/package-summary.html\">add3.add.add - package add3.add.add", + "\"add3/add/add/add/package-summary.html\">add3.add.add.add - package add3.add.add.add" + }; + + void run() throws IOException { + final String clsname = "Add"; + List cmdArgs = new ArrayList(); + cmdArgs.add("-d"); + cmdArgs.add("out-2"); + cmdArgs.add("-sourcepath"); + cmdArgs.add("src"); + cmdArgs.add("-package"); + System.out.println("STRESS_MODE: " + STRESS_MODE); + emitFile(null, clsname, STRESS_MODE); + for (int width = 0; width < MAX_PACKAGES; width++) { + String wpkgname = "add" + width; + String dpkgname = wpkgname; + emitFile(wpkgname, clsname, ListOrder.NONE); // list as-is + cmdArgs.add(wpkgname); + for (int depth = 1; depth < MAX_SUBPACKAGES_DEPTH; depth++) { + dpkgname = dpkgname + ".add"; + emitFile(dpkgname, clsname, STRESS_MODE); + cmdArgs.add(dpkgname); + } + } + File srcDir = new File(new File("."), "src"); + cmdArgs.add(new File(srcDir, clsname + ".java").getPath()); + tester.javadoc(cmdArgs.toArray(new String[cmdArgs.size()])); + tester.checkExit(Exit.OK); + tester.checkOrder("index-all.html", composeTestVectors()); + tester.checkOrder("add0/add/package-tree.html", + "", + ""); + tester.checkOrder("overview-tree.html", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + ""); + + tester.checkOrder("overview-frame.html", + "<unnamed package>", + "add0", + "add0.add", + "add0.add.add", + "add0.add.add.add", + "add1", + "add1.add", + "add1.add.add", + "add1.add.add.add", + "add2", + "add2.add", + "add2.add.add", + "add2.add.add.add", + "add3", + "add3.add", + "add3.add.add", + "add3.add.add.add"); + } + + void emitFile(String pkgname, String clsname, ListOrder order) throws IOException { + File srcDir = new File("src"); + File outDir = pkgname == null + ? srcDir + : new File(srcDir, pkgname.replace(".", File.separator)); + File outFile = new File(outDir, clsname + ".java"); + outDir.mkdirs(); + List scratch = new ArrayList<>(Arrays.asList(contents)); + switch (order) { + case SHUFFLE: + Collections.shuffle(scratch); + break; + case REVERSE: + Collections.reverse(scratch); + break; + default: // leave list as-is + } + // insert the header + scratch.add(0, "public class " + clsname + " {"); + if (pkgname != null) { + scratch.add(0, "package " + pkgname + ";"); + } + // append the footer + scratch.add("}"); + Files.write(outFile.toPath(), scratch, CREATE, TRUNCATE_EXISTING); } - // insert the header - scratch.add(0, "public class " + clsname + " {"); - if (pkgname != null) { - scratch.add(0, "package " + pkgname + ";"); + + String[] composeTestVectors() { + List testList = new ArrayList<>(); + + testList.addAll(Arrays.asList(expectedPackageOrdering)); + for (String x : expectedEnumOrdering) { + testList.add(x.replace("REPLACE_ME", "<Unnamed>")); + for (int i = 0; i < MAX_PACKAGES; i++) { + String wpkg = "add" + i; + testList.add(wpkg + "/" + x.replace("REPLACE_ME", + wpkg)); + String dpkg = wpkg; + for (int j = 1; j < MAX_SUBPACKAGES_DEPTH; j++) { + dpkg = dpkg + "/" + "add"; + testList.add(dpkg + "/" + x.replace("REPLACE_ME", pathToPackage(dpkg))); + } + } + } + + testList.addAll(Arrays.asList(expectedFieldOrdering)); + + for (String x : expectedMethodOrdering) { + testList.add(x); + for (int i = 0; i < MAX_PACKAGES; i++) { + String wpkg = "add" + i; + testList.add(wpkg + "/" + x); + String dpkg = wpkg; + for (int j = 1; j < MAX_SUBPACKAGES_DEPTH; j++) { + dpkg = dpkg + "/" + "add"; + testList.add(dpkg + "/" + x); + } + } + } + + return testList.toArray(new String[testList.size()]); + } + + String pathToPackage(String in) { + return in.replace("/", "."); } - // append the footer - scratch.add("}"); - Files.write(outFile.toPath(), scratch, CREATE, TRUNCATE_EXISTING); } - String pathToPackage(String in) { - return in.replace("/", "."); + static class IndexTypeClusteringTest { + + private final JavadocTester tester; + + IndexTypeClusteringTest(JavadocTester tester) { + this.tester = tester; + } + + void run() { + tester.javadoc("-d", "out-3", + "-sourcepath", tester.testSrc("src-2"), + "-use", + "a", + "b", + "e", + "something"); + + tester.checkExit(Exit.OK); + + tester.checkOrder("index-all.html", + "something - package something", + "something - Class in", + "something - Enum in", + "something - Interface in", + "something - Annotation Type in", + "something - Variable in class", + "something() - Constructor", + "something() - Method in class a. - Method in class a. - Method in class something.add0 - package add0", - "\"add0/add/package-summary.html\">add0.add - package add0.add", - "\"add0/add/add/package-summary.html\">add0.add.add - package add0.add.add", - "\"add0/add/add/add/package-summary.html\">add0.add.add.add - package add0.add.add.add", - "\"add1/package-summary.html\">add1 - package add1", - "\"add1/add/package-summary.html\">add1.add - package add1.add", - "\"add1/add/add/package-summary.html\">add1.add.add - package add1.add.add", - "\"add1/add/add/add/package-summary.html\">add1.add.add.add - package add1.add.add.add", - "\"add2/package-summary.html\">add2 - package add2", - "\"add2/add/package-summary.html\">add2.add - package add2.add", - "\"add2/add/add/package-summary.html\">add2.add.add - package add2.add.add", - "\"add2/add/add/add/package-summary.html\">add2.add.add.add - package add2.add.add.add", - "\"add3/package-summary.html\">add3 - package add3", - "\"add3/add/package-summary.html\">add3.add - package add3.add", - "\"add3/add/add/package-summary.html\">add3.add.add - package add3.add.add", - "\"add3/add/add/add/package-summary.html\">add3.add.add.add - package add3.add.add.add" - }; + tester.checkOrder("pkg5/AnnoFieldTest.html", + "

    Field Detail

    ", + "
    static final int one
    ", + "
    static final int two
    ", + "
    static final int three
    ", + "
    static final int four
    "); - final String expectedMethodOrdering[] = { - "Add.html#add--", - "Add.html#add-double-", - "Add.html#add-double-byte-", - "Add.html#add-double-double-", - "Add.html#add-double-java.lang.Double-", - "Add.html#add-float-", - "Add.html#add-float-int-", - "Add.html#add-int-", - "Add.html#add-int-float-", - "Add.html#add-java.lang.Double-", - "Add.html#add-java.lang.Integer-" - }; + tester.checkOrder("pkg5/AnnoOptionalTest.html", + "

    Optional Element Summary

    ", + "four", + "one", + "three", + "two", + "

    Element Detail

    ", + "

    one

    ", + "

    two

    ", + "

    three

    ", + "

    four

    "); - final String expectedEnumOrdering[] = { - "Add.add.html\" title=\"enum in REPLACE_ME\"", - "Add.ADD.html\" title=\"enum in REPLACE_ME\"" - }; + tester.checkOrder("pkg5/AnnoRequiredTest.html", + "

    Required Element Summary

    ", + "four", + "one", + "three", + "two", + "

    Element Detail

    ", + "

    one

    ", + "

    two

    ", + "

    three

    ", + "

    four

    "); - final String expectedFieldOrdering[] = { - "Add.html#addadd\"", - "add0/add/add/add/Add.html#addadd\"", - "add0/add/add/Add.html#addadd\"", - "add0/add/Add.html#addadd\"", - "add0/Add.html#addadd\"", - "add1/add/add/add/Add.html#addadd\"", - "add1/add/add/Add.html#addadd\"", - "add1/add/Add.html#addadd\"", - "add1/Add.html#addadd\"", - "add2/add/add/add/Add.html#addadd\"", - "add2/add/add/Add.html#addadd\"", - "add2/add/Add.html#addadd\"", - "add2/Add.html#addadd\"", - "add3/add/add/add/Add.html#addadd\"", - "add3/add/add/Add.html#addadd\"", - "add3/add/Add.html#addadd\"", - "add3/Add.html#addadd\"", - "Add.html#AddAdd\"", - "add0/add/add/add/Add.html#AddAdd\"", - "add0/add/add/Add.html#AddAdd\"", - "add0/add/Add.html#AddAdd\"", - "add0/Add.html#AddAdd\"", - "add1/add/add/add/Add.html#AddAdd\"", - "add1/add/add/Add.html#AddAdd\"", - "add1/add/Add.html#AddAdd\"", - "add1/Add.html#AddAdd\"", - "add2/add/add/add/Add.html#AddAdd\"", - "add2/add/add/Add.html#AddAdd\"", - "add2/add/Add.html#AddAdd\"", - "add2/Add.html#AddAdd\"", - "add3/add/add/add/Add.html#AddAdd\"", - "add3/add/add/Add.html#AddAdd\"", - "add3/add/Add.html#AddAdd\"", - "add3/Add.html#AddAdd\"", - "Add.html#ADDADD\"", - "add0/add/add/add/Add.html#ADDADD\"", - "add0/add/add/Add.html#ADDADD\"", - "add0/add/Add.html#ADDADD\"", - "add0/Add.html#ADDADD\"", - "add1/add/add/add/Add.html#ADDADD\"", - "add1/add/add/Add.html#ADDADD\"", - "add1/add/Add.html#ADDADD\"", - "add1/Add.html#ADDADD\"", - "add2/add/add/add/Add.html#ADDADD\"", - "add2/add/add/Add.html#ADDADD\"", - "add2/add/Add.html#ADDADD\"", - "add2/Add.html#ADDADD\"", - "add3/add/add/add/Add.html#ADDADD\"", - "add3/add/add/Add.html#ADDADD\"", - "add3/add/Add.html#ADDADD\"", - "add3/Add.html#ADDADD\"" - }; + tester.checkOrder("pkg5/CtorTest.html", + "

    Constructor Summary

    ", + "Constructor Detail", + "", + "", + "", + ""); - final String expectedPackageTreeOrdering[] = { - "", - "" - }; + tester.checkOrder("pkg5/EnumTest.html", + "

    Enum Constant Summary

    ", + "
    FOUR", + "ONE", + "THREE", + "TWO", + "

    Enum Constant Detail

    ", + "

    ONE

    ", + "

    TWO

    ", + "

    THREE

    ", + "

    FOUR

    "); - final String expectedOverviewOrdering[] = { - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - }; + tester.checkOrder("pkg5/FieldTest.html", + "

    Field Summary

    ", + "
    four", + "one", + "three", + "two", + "

    Field Detail

    ", + "

    one

    ", + "

    two

    ", + "

    three

    ", + "

    four

    "); - final static String expectedOverviewFrameOrdering[] = { - "<unnamed package>", - "add0", - "add0.add", - "add0.add.add", - "add0.add.add.add", - "add1", - "add1.add", - "add1.add.add", - "add1.add.add.add", - "add2", - "add2.add", - "add2.add.add", - "add2.add.add.add", - "add3", - "add3.add", - "add3.add.add", - "add3.add.add.add" - }; + tester.checkOrder("pkg5/IntfTest.html", + "

    Method Summary

    ", + "four", + "one", + "three", + "two", + "

    Method Detail

    ", + "

    one

    ", + "

    two

    ", + "

    three

    ", + "

    four

    "); - final static String expectedImplementsOrdering[] = { - "
    close in interface java.lang.AutoCloseable
    ", - "
    close in interface java.nio.channels.Channel
    ", - "
    close in interface java.io.Closeable
    " - }; + tester.checkOrder("pkg5/MethodTest.html", + "

    Method Summary

    ", + "four", + "one", + "three", + "two", + "

    Method Detail

    ", + "

    one

    ", + "

    two

    ", + "

    three

    ", + "

    four

    "); - final static String expectedOverrideOrdering[] = { - "
    iterator in interface java.util.Collection<", - "
    iterator in interface java.lang.Iterable<" - }; + tester.checkOrder("pkg5/PropertyTest.html", + "

    Property Summary

    ", + "four", + "one", + "three", + "two", + "

    Property Detail

    ", + "

    oneProperty

    ", + "

    twoProperty

    ", + "

    threeProperty

    ", + "

    fourProperty

    "); + } + } } diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/order/MethodOrder.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoFieldTest.java similarity index 63% rename from langtools/test/jdk/javadoc/doclet/testOrdering/order/MethodOrder.java rename to langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoFieldTest.java index d04ceb07c4a..53c0617f3ec 100644 --- a/langtools/test/jdk/javadoc/doclet/testOrdering/order/MethodOrder.java +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoFieldTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -21,32 +21,11 @@ * questions. */ -package order; +package pkg5; -/** - * This class ensures the method detail section contains the methods - * in the order as it appears in the source. - * @author kumasrin - */ -public class MethodOrder { - /** - * Method d. - * Second line. - */ - public void d(){} - /** - * Method b. - * Second line. - */ - public void b() {} - /** - * Method c. - * Second line. - */ - public void c() {} - /** - * Method a. - * Second line. - */ - public void a() {} +public @interface AnnoFieldTest { + public int one = 1; + public int two = 2; + public int three = 3; + public int four = 4; } diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoOptionalTest.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoOptionalTest.java new file mode 100644 index 00000000000..aba053a0476 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoOptionalTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, 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. + */ + +package pkg5; + +public @interface AnnoOptionalTest { + int one() default 1; + int two() default 2; + int three() default 3; + int four() default 4; +} diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoRequiredTest.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoRequiredTest.java new file mode 100644 index 00000000000..f54a0e4af14 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/AnnoRequiredTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, 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. + */ + +package pkg5; + +public @interface AnnoRequiredTest { + int one(); + int two(); + int three(); + int four(); +} diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/CtorTest.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/CtorTest.java new file mode 100644 index 00000000000..60bd64a49e8 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/CtorTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, 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. + */ + +package pkg5; + +public class CtorTest { + public CtorTest(int one, int two, int three, int four) {} + public CtorTest(int one, int two, int three) {} + public CtorTest(int one, int two) {} + public CtorTest(int one) {} +} diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/EnumTest.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/EnumTest.java new file mode 100644 index 00000000000..ef1267f00a5 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/EnumTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, 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. + */ + +package pkg5; + +public enum EnumTest { + ONE, + TWO, + THREE, + FOUR +} diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/FieldTest.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/FieldTest.java new file mode 100644 index 00000000000..66f876e0a85 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/FieldTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, 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. + */ + +package pkg5; + +public class FieldTest { + public int one; + public int two; + public int three; + public int four; +} diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/IntfTest.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/IntfTest.java new file mode 100644 index 00000000000..959034ed16b --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/IntfTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, 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. + */ + +package pkg5; + +public interface IntfTest { + void one(); + void two(); + void three(); + void four(); +} diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/MethodTest.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/MethodTest.java new file mode 100644 index 00000000000..9333b30c00d --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/MethodTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, 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. + */ + +package pkg5; + +public class MethodTest { + public void one(){} + public void two(){} + public void three(){} + public void four(){} +} diff --git a/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/PropertyTest.java b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/PropertyTest.java new file mode 100644 index 00000000000..b53752a1e1a --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testOrdering/pkg5/PropertyTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, 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. + */ + +package pkg5; + +public class PropertyTest { + public int oneProperty() { return 1; } + public int twoProperty() { return 2; } + public int threeProperty() { return 3; } + public int fourProperty() { return 4; } +} From d867ed9a8def5e02602c2aec5e097b04e73e9663 Mon Sep 17 00:00:00 2001 From: Srinivas Dama Date: Mon, 14 Nov 2016 22:33:33 -0800 Subject: [PATCH 46/54] 8156615: Catch parameter can be a BindingPattern in ES6 mode Added parser support for catch parameter being a binding pattern Reviewed-by: sundar, hannesw, attila --- .../jdk/nashorn/api/tree/IRTranslator.java | 2 +- .../internal/codegen/AssignSymbols.java | 2 +- .../internal/codegen/CodeGenerator.java | 2 +- .../codegen/LocalVariableTypesCalculator.java | 2 +- .../jdk/nashorn/internal/codegen/Lower.java | 9 + .../jdk/nashorn/internal/ir/CatchNode.java | 54 ++- .../jdk/nashorn/internal/parser/Parser.java | 20 +- .../test/script/basic/es6/destructuring.js | 7 + .../basic/es6/destructuring.js.EXPECTED | 21 + .../nosecurity/treeapi/destructuring_catch.js | 51 +++ .../treeapi/destructuring_catch.js.EXPECTED | 399 ++++++++++++++++++ 11 files changed, 544 insertions(+), 25 deletions(-) create mode 100644 nashorn/test/script/nosecurity/treeapi/destructuring_catch.js create mode 100644 nashorn/test/script/nosecurity/treeapi/destructuring_catch.js.EXPECTED diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java index 974f56c7ccc..041ab612c34 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java @@ -384,7 +384,7 @@ final class IRTranslator extends SimpleNodeVisitor { final List catchTrees = new ArrayList<>(catchNodes.size()); for (final CatchNode catchNode : catchNodes) { catchTrees.add(new CatchTreeImpl(catchNode, - translateIdent(catchNode.getException()), + translateExpr(catchNode.getException()), (BlockTree) translateBlock(catchNode.getBody()), translateExpr(catchNode.getExceptionCondition()))); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java index fdc828b50b1..3bb44b5aa13 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java @@ -462,7 +462,7 @@ final class AssignSymbols extends SimpleNodeVisitor implements Loggable { @Override public boolean enterCatchNode(final CatchNode catchNode) { - final IdentNode exception = catchNode.getException(); + final IdentNode exception = catchNode.getExceptionIdentifier(); final Block block = lc.getCurrentBlock(); start(catchNode); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java index f04f8959339..c4053bcf1e6 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java @@ -3255,7 +3255,7 @@ final class CodeGenerator extends NodeOperatorVisitor implements Lo return checkEval(callNode.setFunction(markerFunction(callNode.getFunction()))); } + @Override + public boolean enterCatchNode(final CatchNode catchNode) { + Expression exception = catchNode.getException(); + if ((exception != null) && !(exception instanceof IdentNode)) { + throwNotImplementedYet("es6.destructuring", exception); + } + return true; + } + @Override public Node leaveCatchNode(final CatchNode catchNode) { return addStatement(catchNode); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CatchNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CatchNode.java index 80ca3a509c9..9431f3b3acb 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CatchNode.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CatchNode.java @@ -35,8 +35,8 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor; public final class CatchNode extends Statement { private static final long serialVersionUID = 1L; - /** Exception identifier. */ - private final IdentNode exception; + /** Exception binding identifier or binding pattern. */ + private final Expression exception; /** Exception condition. */ private final Expression exceptionCondition; @@ -52,21 +52,27 @@ public final class CatchNode extends Statement { * @param lineNumber lineNumber * @param token token * @param finish finish - * @param exception variable name of exception + * @param exception variable name or pattern of exception * @param exceptionCondition exception condition * @param body catch body * @param isSyntheticRethrow true if this node is a synthetically generated rethrow node. */ - public CatchNode(final int lineNumber, final long token, final int finish, final IdentNode exception, + public CatchNode(final int lineNumber, final long token, final int finish, final Expression exception, final Expression exceptionCondition, final Block body, final boolean isSyntheticRethrow) { super(lineNumber, token, finish); - this.exception = exception == null ? null : exception.setIsInitializedHere(); + if (exception instanceof IdentNode) { + this.exception = ((IdentNode) exception).setIsInitializedHere(); + } else if ((exception instanceof LiteralNode.ArrayLiteralNode) || (exception instanceof ObjectNode)) { + this.exception = exception; + } else { + throw new IllegalArgumentException("invalid catch parameter"); + } this.exceptionCondition = exceptionCondition; - this.body = body; + this.body = body; this.isSyntheticRethrow = isSyntheticRethrow; } - private CatchNode(final CatchNode catchNode, final IdentNode exception, final Expression exceptionCondition, + private CatchNode(final CatchNode catchNode, final Expression exception, final Expression exceptionCondition, final Block body, final boolean isSyntheticRethrow) { super(catchNode); this.exception = exception; @@ -83,11 +89,10 @@ public final class CatchNode extends Statement { public Node accept(final NodeVisitor visitor) { if (visitor.enterCatchNode(this)) { return visitor.leaveCatchNode( - setException((IdentNode)exception.accept(visitor)). - setExceptionCondition(exceptionCondition == null ? null : (Expression)exceptionCondition.accept(visitor)). - setBody((Block)body.accept(visitor))); + setException((Expression) exception.accept(visitor)). + setExceptionCondition(exceptionCondition == null ? null : (Expression) exceptionCondition.accept(visitor)). + setBody((Block) body.accept(visitor))); } - return this; } @@ -109,13 +114,24 @@ public final class CatchNode extends Statement { } /** - * Get the identifier representing the exception thrown - * @return the exception identifier + * Get the binding pattern representing the exception thrown + * + * @return the exception binding pattern */ - public IdentNode getException() { + public Expression getException() { return exception; } + /** + * Get the identifier representing the exception thrown + * + * @return the exception identifier + * @throws ClassCastException if exception set is not binding identifier + */ + public IdentNode getExceptionIdentifier() { + return (IdentNode) exception; + } + /** * Get the exception condition for this catch block * @return the exception condition @@ -146,13 +162,19 @@ public final class CatchNode extends Statement { /** * Resets the exception of a catch block - * @param exception new exception + * + * @param exception new exception which can be binding identifier or binding + * pattern * @return new catch node if changed, same otherwise */ - public CatchNode setException(final IdentNode exception) { + public CatchNode setException(final Expression exception) { if (this.exception == exception) { return this; } + /*check if exception is legitimate*/ + if (!((exception instanceof IdentNode) || (exception instanceof LiteralNode.ArrayLiteralNode) || (exception instanceof ObjectNode))) { + throw new IllegalArgumentException("invalid catch parameter"); + } return new CatchNode(this, exception, exceptionCondition, body, isSyntheticRethrow); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java index c609a0d18c7..fb4fd433b42 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java @@ -2619,13 +2619,23 @@ public class Parser extends AbstractParser implements Loggable { next(); expect(LPAREN); - // FIXME: ES6 catch parameter can be a BindingIdentifier or a BindingPattern - // We need to generalize this here! + // ES6 catch parameter can be a BindingIdentifier or a BindingPattern // http://www.ecma-international.org/ecma-262/6.0/ - final IdentNode exception = getIdent(); + final String contextString = "catch argument"; + final Expression exception = bindingIdentifierOrPattern(contextString); + final boolean isDestructuring = !(exception instanceof IdentNode); + if (isDestructuring) { + verifyDestructuringBindingPattern(exception, new Consumer() { + @Override + public void accept(final IdentNode identNode) { + verifyIdent(identNode, contextString); + } + }); + } else { + // ECMA 12.4.1 strict mode restrictions + verifyStrictIdent((IdentNode) exception, "catch argument"); + } - // ECMA 12.4.1 strict mode restrictions - verifyStrictIdent(exception, "catch argument"); // Nashorn extension: catch clause can have optional // condition. So, a single try can have more than one diff --git a/nashorn/test/script/basic/es6/destructuring.js b/nashorn/test/script/basic/es6/destructuring.js index a7f7a59de04..d2b2a1bd31e 100644 --- a/nashorn/test/script/basic/es6/destructuring.js +++ b/nashorn/test/script/basic/es6/destructuring.js @@ -62,4 +62,11 @@ check("(function({ x }) { return x; })()"); check("(function([x]) { return x; })()"); check("for (var [[x, y, z] = [4, 5, 6]] = [7, 8, 9]; iterCount < 1; ) ;"); check("for ([ arrow = () => {} ] of [[]]) ;"); +check("try { throw null;} catch({}) { }"); +check("try { throw {} } catch ({}) { }"); +check("try { throw [] } catch ([,]) { }"); +check("try { throw { w: [7, undefined, ] }} catch ({ w: [x, y, z] = [4, 5, 6] }) { }"); +check("try { throw { a: 2, b: 3} } catch ({a, b}) { }"); +check("try { throw [null] } catch ([[x]]) { }"); +check("try { throw { w: undefined } } catch ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { }"); diff --git a/nashorn/test/script/basic/es6/destructuring.js.EXPECTED b/nashorn/test/script/basic/es6/destructuring.js.EXPECTED index 65e2eda1dc9..54ecd96a3fa 100644 --- a/nashorn/test/script/basic/es6/destructuring.js.EXPECTED +++ b/nashorn/test/script/basic/es6/destructuring.js.EXPECTED @@ -70,3 +70,24 @@ for (var [[x, y, z] = [4, 5, 6]] = [7, 8, 9]; iterCount < 1; ) ; java.lang.RuntimeException: test/script/basic/es6/destructuring.js#35:6:1:0 ES6 destructuring is not yet implemented for ([ arrow = () => {} ] of [[]]) ; ^ +java.lang.RuntimeException: test/script/basic/es6/destructuring.js#35:6:1:25 ES6 destructuring is not yet implemented +try { throw null;} catch({}) { } + ^ +java.lang.RuntimeException: test/script/basic/es6/destructuring.js#35:6:1:24 ES6 destructuring is not yet implemented +try { throw {} } catch ({}) { } + ^ +java.lang.RuntimeException: test/script/basic/es6/destructuring.js#35:6:1:24 ES6 destructuring is not yet implemented +try { throw [] } catch ([,]) { } + ^ +java.lang.RuntimeException: test/script/basic/es6/destructuring.js#35:6:1:44 ES6 destructuring is not yet implemented +try { throw { w: [7, undefined, ] }} catch ({ w: [x, y, z] = [4, 5, 6] }) { } + ^ +java.lang.RuntimeException: test/script/basic/es6/destructuring.js#35:6:1:35 ES6 destructuring is not yet implemented +try { throw { a: 2, b: 3} } catch ({a, b}) { } + ^ +java.lang.RuntimeException: test/script/basic/es6/destructuring.js#35:6:1:28 ES6 destructuring is not yet implemented +try { throw [null] } catch ([[x]]) { } + ^ +java.lang.RuntimeException: test/script/basic/es6/destructuring.js#35:6:1:38 ES6 destructuring is not yet implemented +try { throw { w: undefined } } catch ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { } + ^ diff --git a/nashorn/test/script/nosecurity/treeapi/destructuring_catch.js b/nashorn/test/script/nosecurity/treeapi/destructuring_catch.js new file mode 100644 index 00000000000..ff399fee444 --- /dev/null +++ b/nashorn/test/script/nosecurity/treeapi/destructuring_catch.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016, 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. + */ + +/** + * Tests to check representation of ES6 catch parameter as binding pattern. + * + * @test + * @option -scripting + * @run + */ + +load(__DIR__ + "utils.js") + +var code = < Date: Tue, 15 Nov 2016 10:00:00 +0100 Subject: [PATCH 47/54] 8169632: Update compare script for clean compare Reviewed-by: tbell --- common/bin/compare.sh | 75 +++++---------------------- common/bin/compare_exceptions.sh.incl | 2 + 2 files changed, 14 insertions(+), 63 deletions(-) diff --git a/common/bin/compare.sh b/common/bin/compare.sh index 21c9051e426..ba60485ea53 100644 --- a/common/bin/compare.sh +++ b/common/bin/compare.sh @@ -372,7 +372,7 @@ compare_general_files() { $CAT $OTHER_DIR/$f | eval "$HTML_FILTER" > $OTHER_FILE & $CAT $THIS_DIR/$f | eval "$HTML_FILTER" > $THIS_FILE & wait - elif [ "$f" = "./lib/classlist" ]; then + elif [[ "$f" = *"/lib/classlist" ]]; then # The classlist files may have some lines in random order OTHER_FILE=$WORK_DIR/$f.other THIS_FILE=$WORK_DIR/$f.this @@ -642,69 +642,18 @@ compare_bin_file() { if [ "$OPENJDK_TARGET_OS" = "windows" ]; then unset _NT_SYMBOL_PATH - # On windows we need to unzip the debug symbols, if present - OTHER_FILE_BASE=${OTHER_FILE/.dll/} - OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/} - OTHER_FILE_BASE=${OTHER_FILE_BASE/.cpl/} - DIZ_NAME=$(basename $OTHER_FILE_BASE).diz - # Some .exe files have the same name as a .dll file. Make sure the exe - # files get the right debug symbols. - if [ "$NAME" = "java.exe" ] \ - && [ -f "$OTHER/support/native/java.base/java_objs/java.diz" ]; then - OTHER_DIZ_FILE="$OTHER/support/native/java.base/java_objs/java.diz" - elif [ "$NAME" = "jimage.exe" ] \ - && [ -f "$OTHER/support/native/jdk.jlink/jimage_objs/jimage.diz" ]; then - OTHER_DIZ_FILE="$OTHER/support/modules_cmds/jdk.jlink/jimage.diz" - elif [ "$NAME" = "javacpl.exe" ] \ - && [ -f "$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then - OTHER_DIZ_FILE="$OTHER/support/modules_cmds/jdk.deploy.controlpanel/javacpl.diz" - elif [ -f "${OTHER_FILE_BASE}.diz" ]; then - OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz - else - # Some files, jli.dll, appears twice in the image but only one of - # them has a diz file next to it. - OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)" - if [ ! -f "$OTHER_DIZ_FILE" ]; then - # As a last resort, look for diz file in the whole build output - # dir. - OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)" - fi - fi - if [ -n "$OTHER_DIZ_FILE" ]; then - $MKDIR -p $FILE_WORK_DIR/other - (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE) - export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other" - fi - - THIS_FILE_BASE=${THIS_FILE/.dll/} - THIS_FILE_BASE=${THIS_FILE_BASE/.exe/} - THIS_FILE_BASE=${THIS_FILE_BASE/.cpl/} - # Some .exe files have the same name as a .dll file. Make sure the exe - # files get the right debug symbols. - if [ "$NAME" = "java.exe" ] \ - && [ -f "$THIS/support/native/java.base/java_objs/java.diz" ]; then - THIS_DIZ_FILE="$THIS/support/native/java.base/java_objs/java.diz" - elif [ "$NAME" = "jimage.exe" ] \ - && [ -f "$THIS/support/native/jdk.jlink/jimage_objs/jimage.diz" ]; then - THIS_DIZ_FILE="$THIS/support/modules_cmds/jdk.jlink/jimage.diz" - elif [ "$NAME" = "javacpl.exe" ] \ - && [ -f "$THIS/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then - THIS_DIZ_FILE="$THIS/support/modules_cmds/jdk.deploy.controlpanel/javacpl.diz" - elif [ -f "${THIS_FILE_BASE}.diz" ]; then - THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz - else - THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)" - if [ ! -f "$THIS_DIZ_FILE" ]; then - # As a last resort, look for diz file in the whole build output - # dir. - THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)" - fi - fi - if [ -n "$THIS_DIZ_FILE" ]; then - $MKDIR -p $FILE_WORK_DIR/this - (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE) - export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this" + if [ "$(uname -o)" = "Cygwin" ]; then + THIS=$(cygpath -msa $THIS) + OTHER=$(cygpath -msa $OTHER) fi + # Build an _NT_SYMBOL_PATH that contains all known locations for + # pdb files. + PDB_DIRS="$(ls -d \ + {$OTHER,$THIS}/support/modules_{cmds,libs}/{*,*/*} \ + {$OTHER,$THIS}/support/demos/image/jvmti/*/lib \ + {$OTHER,$THIS}/support/native/java.base/java_objs \ + )" + export _NT_SYMBOL_PATH="$(echo $PDB_DIRS | tr ' ' ';')" fi if [ -z "$SKIP_BIN_DIFF" ]; then diff --git a/common/bin/compare_exceptions.sh.incl b/common/bin/compare_exceptions.sh.incl index a4c4278299a..5042cdcc104 100644 --- a/common/bin/compare_exceptions.sh.incl +++ b/common/bin/compare_exceptions.sh.incl @@ -431,6 +431,8 @@ if [ "$OPENJDK_TARGET_OS" = "windows" ]; then ACCEPTED_JARZIP_CONTENTS=" /modules_libs/java.security.jgss/w2k_lsa_auth.diz + /modules_libs/java.security.jgss/w2k_lsa_auth.pdb + /modules_libs/java.security.jgss/w2k_lsa_auth.map /modules_libs/java.security.jgss/w2k_lsa_auth.dll " From 8d64cef95c113d9f85a6c31c92221fb5a37d4d01 Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Tue, 15 Nov 2016 10:53:32 -0400 Subject: [PATCH 48/54] 8169720: jimage help message for --include option should be corrected Reviewed-by: alanb, sundar --- .../classes/jdk/tools/jimage/resources/jimage.properties | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties b/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties index 24bffe3e1a5..2b53cf8d64f 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties @@ -71,9 +71,7 @@ main.opt.footer=\ \ separated list of elements each using one the following forms:\n\ \ \n\ \ glob:\n\ -\ regex:\n\ -\ @ where filename is the name of a file containing patterns to be\ -\ used, one pattern per line\n\ +\ regex: main.opt.full-version=\ From 3630a6a4f815f7d8d9e7e02266a2aabc1a9174e9 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Tue, 15 Nov 2016 08:40:36 -0800 Subject: [PATCH 49/54] 8168500: (se) EPollArrayWrapper optimization for update events should be robust to dynamic changes in file descriptor resource limits Make eventsHigh final and always initialize it to an empty Map. Reviewed-by: alanb --- .../linux/classes/sun/nio/ch/EPollArrayWrapper.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/jdk/src/java.base/linux/classes/sun/nio/ch/EPollArrayWrapper.java b/jdk/src/java.base/linux/classes/sun/nio/ch/EPollArrayWrapper.java index e6a2b584d96..f34274eed99 100644 --- a/jdk/src/java.base/linux/classes/sun/nio/ch/EPollArrayWrapper.java +++ b/jdk/src/java.base/linux/classes/sun/nio/ch/EPollArrayWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, 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 @@ -118,7 +118,7 @@ class EPollArrayWrapper { // file descriptors higher than MAX_UPDATE_ARRAY_SIZE (unlimited case at // least) then the update is stored in a map. private final byte[] eventsLow = new byte[MAX_UPDATE_ARRAY_SIZE]; - private Map eventsHigh; + private final Map eventsHigh = new HashMap<>(); // Used by release and updateRegistrations to track whether a file // descriptor is registered with epoll. @@ -133,10 +133,6 @@ class EPollArrayWrapper { int allocationSize = NUM_EPOLLEVENTS * SIZE_EPOLLEVENT; pollArray = new AllocatedNativeObject(allocationSize, true); pollArrayAddress = pollArray.address(); - - // eventHigh needed when using file descriptors > 64k - if (OPEN_MAX > MAX_UPDATE_ARRAY_SIZE) - eventsHigh = new HashMap<>(); } void initInterrupt(int fd0, int fd1) { From 1f0667986a0c62f1235f3bb5fad77f7690c54f55 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 22:26:07 +0200 Subject: [PATCH 50/54] Added tag jdk-9+144 for changeset 31f5023200d4 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index f54925473b1..3ef3763073a 100644 --- a/.hgtags +++ b/.hgtags @@ -386,3 +386,4 @@ d273dfe9a126d3bffe92072547fef2cd1361b0eb jdk-9+138 9aadd2163b568d76f8969ad2fb404a63733da359 jdk-9+141 df0e03e3ca0ed1307793017dfc1a054c8726131c jdk-9+142 d62173b931bf5b6bffc6e80a9060bb2e8b8efc75 jdk-9+143 +31f5023200d42185b70c4c00ba5672391e4642d0 jdk-9+144 From c97f7be269b6be5468bc1a6bb16398d65bee84f6 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 17 Nov 2016 17:50:05 +0000 Subject: [PATCH 51/54] Added tag jdk-9+145 for changeset b57b4dfdfeae --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 27933595820..60e0db5186c 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -387,3 +387,4 @@ f64afae7f1a5608e438585bbf0bc23785e69cba0 jdk-9+141 2b3e5caafe3594ea507c37675c4d3086f415dc64 jdk-9+142 1fc62b1c629fb80fdaa639d3b59452a184f0d705 jdk-9+143 8d337fd6333e28c48aa87880144b840aad82baaf jdk-9+144 +ff98aa9ec9fae991e426ce5926fc9036d25f5562 jdk-9+145 From 7ae986d83ecc77034319dd0e849a76baa9c342ea Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 18 Nov 2016 15:50:43 +0100 Subject: [PATCH 52/54] 8169860: Clean up and unify the refactored Javadoc generation Reviewed-by: erikj --- make/Javadoc.gmk | 535 ++++++++-------------------------- make/common/CORE_PKGS.gmk | 305 ------------------- make/common/MakeBase.gmk | 6 +- make/common/NON_CORE_PKGS.gmk | 132 --------- test/make/TestMakeBase.gmk | 5 +- 5 files changed, 135 insertions(+), 848 deletions(-) delete mode 100644 make/common/CORE_PKGS.gmk delete mode 100644 make/common/NON_CORE_PKGS.gmk diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index 98bf06f2e28..8a0a4cf0fd6 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -55,12 +55,6 @@ DOCROOTPARENT_FLAG = TRUE # depend on it. CORE_INDEX_FILE := $(JAVADOC_OUTPUTDIR)/api/index.html -# Symbols -TRADEMARK := ™ -COPYRIGHT_SYMBOL := &$(HASH)x00a9; -COPYRIGHT_TEXT := Copyright -ALL_RIGHTS_RESERVED := All rights reserved. - # URLs JAVADOC_BASE_URL := http://docs.oracle.com/javase/$(VERSION_SPECIFICATION)/docs BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/ @@ -69,18 +63,16 @@ BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/ # Text snippets FULL_COMPANY_NAME := Oracle and/or its affiliates -COMPANY_ADDRESS := 500 Oracle Parkway
    Redwood Shores, CA 94065 USA. +COMPANY_ADDRESS := 500 Oracle Parkway
    Redwood Shores, CA 94065 USA BUG_SUBMIT_LINE := Submit a bug or feature -JAVA_TRADEMARK_LINE := Java is a trademark or registered trademark of \ - $(FULL_COMPANY_NAME) in the US and other countries. -COMMON_BOTTOM_ADDRESS := $(COMPANY_ADDRESS) -COMMON_BOTTOM_TEXT := $(BUG_SUBMIT_LINE)
    $(JAVA_TRADEMARK_LINE) +COMMON_BOTTOM_TEXT := $(BUG_SUBMIT_LINE)
    Java is a trademark or registered \ + trademark of $(FULL_COMPANY_NAME) in the US and other countries. CORE_BOTTOM_COPYRIGHT_URL := {@docroot}/../legal/cpyr.html -CORE_BOTTOM_TEXT := $(BUG_SUBMIT_LINE)\ -
    For further API reference and developer documentation, \ -see Java SE \ +CORE_BOTTOM_TEXT := $(BUG_SUBMIT_LINE) \ +
    For further API reference and developer documentation, see \ +
    Java SE \ Documentation. That documentation contains more detailed, \ developer-targeted descriptions, with conceptual overviews, definitions of \ terms, workarounds, and working code examples. @@ -94,18 +86,19 @@ else # We need a draft format when not building the GA version. DRAFT_HEADER :=
    DRAFT $(VERSION_STRING) DRAFT_BOTTOM :=
    DRAFT $(VERSION_STRING) - DRAFT_WINTITLE := $(VERSION_BUILD) + ifeq ($(VERSION_BUILD), 0) + DRAFT_WINTITLE := [ad-hoc build] + else + DRAFT_WINTITLE := [build $(VERSION_BUILD)] + endif CORE_TOP_EARLYACCESS := \
    \
    \ -Please note that the specifications and other information \ -contained herein are not final and are subject to change. \ -The information is being made available to you solely for purpose of \ -evaluation. \ -
    +margin-left: 6px; margin-right: 6px; text-align: justify; font-size: 80%; \ +font-family: Helvetica, Arial, sans-serif; font-weight: normal;"> \ +Please note that the specifications and other information contained herein are \ +not final and are subject to change. The information is being made available \ +to you solely for purpose of evaluation. endif ################################################################################ @@ -127,22 +120,17 @@ endef # Arguments: # arg 1: first copyright year # arg 2: copyright url (optional) -# arg 3: company address (optional) -# arg 4: free-form text snippet (optional) +# arg 3: free-form text snippet (optional) define GenerateBottom - $(if $(strip $4), $(strip $4))
    $(if \ - $(strip $2),$(COPYRIGHT_TEXT),$(COPYRIGHT_TEXT)) \ - $(COPYRIGHT_SYMBOL) $(strip $1), $(COPYRIGHT_YEAR), \ - $(FULL_COMPANY_NAME). $(strip $3) \ - $(ALL_RIGHTS_RESERVED)$(if $(strip $4), )
    + $(if $(strip $3), $(strip $3))
    $(if \ + $(strip $2),Copyright,Copyright) \ + © $(strip $1), $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \ + $(COMPANY_ADDRESS). All rights reserved.
    endef # Speed up finding by filling cache $(eval $(call FillCacheFind, $(wildcard $(JAVADOC_SOURCE_DIRS)))) -# Prevent # from expanding -EscapeHash = $(subst $(HASH),{hash},$(strip $1)) - ################################################################################ # Setup make rules for running javadoc. # @@ -154,7 +142,6 @@ EscapeHash = $(subst $(HASH),{hash},$(strip $1)) # Remaining parameters are named arguments. These include: # MODULES - Modules to include # PACKAGES - Packages to include -# PACKAGE_FILTER - Filter for packages # IS_CORE - Set to TRUE for the Core API package which needs special treatment # API_ROOT - Where to base the documentation (jre or jdk) # DEST_DIR - A directory relative to the API root @@ -164,15 +151,10 @@ EscapeHash = $(subst $(HASH),{hash},$(strip $1)) # HEADER_TITLE - Title to use in -header. Computed from TITLE if empty. # DOC_TITLE - Title to use in -doctitle. Computed from TITLE if empty. # FIRST_COPYRIGHT_YEAR - First year this bundle was introduced -# DOCLINT - Doclint level. Defaults to "all". +# DISABLED_DOCLINT - Doclint warnings to exclude. # DOCLINT_PACKAGES - Optional -Xdoclint/package value -# ENCODING - Change character encoding (defaults to 'ascii') -# SPLIT_INDEX - Enable -splitIndex -# BREAKITERATOR - Enable -breakiterator -# NODEPRECATEDLIST - Enable nodeprecatedlist -# NOINDEX - Enable -noindex and -nonavbar +# SPLIT_INDEX - Enable -splitIndex (split index-all.html if it is too large) # BOTTOM_COPYRIGHT_URL - Copyright URL to use in -bottom -# BOTTOM_ADDRESS - Company address to use in -bottom # BOTTOM_TEXT - Extra text to use in -bottom # EXTRA_TOP - Additional -top data # @@ -185,16 +167,13 @@ define SetupJavadocGenerationBody $1_JAVA := $$(JAVA_SMALL) $1_OUTPUT_DIRNAME := $$($1_API_ROOT)/api/$$($1_DEST_DIR) - ifeq ($$($1_RELATIVE_CORE_DIR),) - # Compute a relative path to core root. - # The non-core api javadocs need to be able to access the root of the core - # api directory, so for jdk/api or jre/api to get to the core api/ - # directory we would use this - # NOTE: Need to be able to override for broken old code in JShell - $1_RELATIVE_CORE_DIR := $$(strip $$(subst $$(call DirToDotDot, \ - $$(JAVADOC_OUTPUTDIR))/,, $$(call DirToDotDot, \ - $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)))) - endif + # Compute a relative path to core root. + # The non-core api javadocs need to be able to access the root of the core + # api directory, so for jdk/api or jre/api to get to the core api/ + # directory we would use this + $1_RELATIVE_CORE_DIR := $$(strip $$(subst $$(call DirToDotDot, \ + $$(JAVADOC_OUTPUTDIR))/,, $$(call DirToDotDot, \ + $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)))) $1_DEPS += $(CORE_INDEX_FILE) endif @@ -203,12 +182,11 @@ define SetupJavadocGenerationBody $1_DEPS += $$($1_OVERVIEW) endif - ifeq ($$($1_ENCODING), ) - $1_ENCODING := ascii - endif - - ifeq ($$($1_DOCLINT), ) + ifeq ($$($1_DISABLED_DOCLINT), ) $1_DOCLINT := all + else + # Create a string like "all,-syntax,-html" + $1_DOCLINT := all,$$(call CommaList, $$(addprefix -, $$($1_DISABLED_DOCLINT))) endif ifeq ($$($1_DOC_TITLE), ) @@ -216,23 +194,27 @@ define SetupJavadocGenerationBody endif ifeq ($$($1_WINDOW_TITLE), ) - $1_WINDOW_TITLE := $$(strip $$(subst $$(TRADEMARK),, $$($1_TITLE))) + $1_WINDOW_TITLE := $$(strip $$(subst ™,, $$($1_TITLE))) endif ifeq ($$($1_HEADER_TITLE), ) - $1_HEADER_TITLE := $$(strip $$(subst $$(TRADEMARK),, $$($1_TITLE))) + $1_HEADER_TITLE := $$(strip $$(subst ™,, $$($1_TITLE))) endif $1_HEADER := $$($1_HEADER_TITLE) + ifeq ($$($1_BOTTOM_TEXT), ) + $1_BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT) + endif + $1_BOTTOM := $$(call GenerateBottom, $$($1_FIRST_COPYRIGHT_YEAR), \ - $$($1_BOTTOM_COPYRIGHT_URL), $$($1_BOTTOM_ADDRESS), $$($1_BOTTOM_TEXT)) + $$($1_BOTTOM_COPYRIGHT_URL), $$($1_BOTTOM_TEXT)) # The index.html, options, and packages files $1_INDEX_FILE := $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)/index.html $1_OPTIONS_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.options $1_PACKAGES_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.packages - $1_PACKAGES_VARDEPS := $$($1_PACKAGES) $$($1_PACKAGES_SINGLE_CLASS) + $1_PACKAGES_VARDEPS := $$($1_PACKAGES) $1_PACKAGES_VARDEPS_FILE := $$(call DependOnVariable, $1_PACKAGES_VARDEPS, \ $$($1_PACKAGES_FILE).vardeps) @@ -240,24 +222,14 @@ define SetupJavadocGenerationBody $$($1_PACKAGES_FILE): $$($1_PACKAGES_VARDEPS_FILE) $$(call LogInfo, Creating Javadoc package file for $1) $$(call MakeDir, $$(@D)) - ifeq ($$($1_PACKAGES_SINGLE_CLASS), ) - $$(ECHO) $$($1_PACKAGES) | $$(TR) ' ' '\n' > $$@ - else - # NOTE: This is for backwards compatibility for taglet - $$(ECHO) $$($1_PACKAGES_SINGLE_CLASS) > $$@ - endif + $$(ECHO) $$($1_PACKAGES) | $$(TR) ' ' '\n' > $$@ - # NOTE: Not including $$($1_EXTRA_TOP) due to $$(HASH) - $1_OPTIONS_VARDEPS := $$(call EscapeHash, \ - $$($DOCROOTPARENT_FLAG) $$(JAVADOC_BASE_URL) $$($1_NO_COMMON_TAGS) \ - $$($1_DOCLINT) $$($1_DOCLINT_PACKAGES) $$(JAVADOC_SOURCE_DIRS) \ - $$($1_MODULES) $$($1_ENCODING) $$($1_NODEPRECATEDLIST) \ - $$($1_BREAKITERATOR) $$($1_SPLIT_INDEX) $$($1_OVERVIEW) \ - $$($1_DOC_TITLE) $$($1_WINDOW_TITLE) $$(DRAFT_WINTITLE) \ - $$($1_HEADER) $$(DRAFT_HEADER) $$($1_NOINDEX) $$($1_EXTRA_TOP_2) \ - $$($1_BOTTOM) $$(DRAFT_BOTTOM)) $$($1_PACKAGE_FILTER) $$($1_RELATIVE_CORE_DIR) \ - $$(JAVADOC_OUTPUTDIR) \ - ) + $1_OPTIONS_VARDEPS := $$($1_EXTRA_TOP) \ + $$($DOCROOTPARENT_FLAG) $$(JAVADOC_BASE_URL) $$($1_DISABLED_DOCLINT) \ + $$($1_DOCLINT_PACKAGES) $$(JAVADOC_SOURCE_DIRS) $$($1_MODULES) \ + $$($1_SPLIT_INDEX) $$($1_OVERVIEW) $$($1_DOC_TITLE) $$($1_WINDOW_TITLE) \ + $$(DRAFT_WINTITLE) $$($1_HEADER) $$(DRAFT_HEADER) $$($1_BOTTOM) \ + $$(DRAFT_BOTTOM)) $$($1_RELATIVE_CORE_DIR) $$(JAVADOC_OUTPUTDIR) $1_OPTIONS_VARDEPS_FILE := $$(call DependOnVariable, $1_OPTIONS_VARDEPS, \ $$($1_OPTIONS_FILE).vardeps) @@ -273,35 +245,32 @@ define SetupJavadocGenerationBody $$(call AddOption, -use) $$(call AddOption, -keywords) ifneq ($$($DOCROOTPARENT_FLAG), ) - # NOTE: Argument to -Xdocrootparent is not quoted to keep backwards compatibility. - $$(call AddOption, -Xdocrootparent $(JAVADOC_BASE_URL)) - endif - ifneq ($$($1_NO_COMMON_TAGS), TRUE) - # In order to get a specific ordering it's necessary to specify the total - # ordering of tags as the tags are otherwise ordered in order of definition. - $$(call AddOption, -tag, beaninfo:X) - $$(call AddOption, -tag, revised:X) - $$(call AddOption, -tag, since.unbundled:X) - $$(call AddOption, -tag, spec:X) - $$(call AddOption, -tag, specdefault:X) - $$(call AddOption, -tag, Note:X) - $$(call AddOption, -tag, ToDo:X) - $$(call AddOption, -tag, apiNote:a:API Note:) - $$(call AddOption, -tag, implSpec:a:Implementation Requirements:) - $$(call AddOption, -tag, implNote:a:Implementation Note:) - $$(call AddOption, -tag, param) - $$(call AddOption, -tag, return) - $$(call AddOption, -tag, throws) - $$(call AddOption, -tag, since) - $$(call AddOption, -tag, version) - $$(call AddOption, -tag, serialData) - $$(call AddOption, -tag, factory) - $$(call AddOption, -tag, see) - $$(call AddOption, -tag, \ - jvms:a:See The Java™ Virtual Machine Specification:) - $$(call AddOption, -tag, \ - jls:a:See The Java™ Language Specification:) + $$(call AddOption, -Xdocrootparent, $(JAVADOC_BASE_URL)) endif + # In order to get a specific ordering it's necessary to specify the total + # ordering of tags as the tags are otherwise ordered in order of definition. + $$(call AddOption, -tag, beaninfo:X) + $$(call AddOption, -tag, revised:X) + $$(call AddOption, -tag, since.unbundled:X) + $$(call AddOption, -tag, spec:X) + $$(call AddOption, -tag, specdefault:X) + $$(call AddOption, -tag, Note:X) + $$(call AddOption, -tag, ToDo:X) + $$(call AddOption, -tag, apiNote:a:API Note:) + $$(call AddOption, -tag, implSpec:a:Implementation Requirements:) + $$(call AddOption, -tag, implNote:a:Implementation Note:) + $$(call AddOption, -tag, param) + $$(call AddOption, -tag, return) + $$(call AddOption, -tag, throws) + $$(call AddOption, -tag, since) + $$(call AddOption, -tag, version) + $$(call AddOption, -tag, serialData) + $$(call AddOption, -tag, factory) + $$(call AddOption, -tag, see) + $$(call AddOption, -tag, \ + jvms:a:See The Java™ Virtual Machine Specification:) + $$(call AddOption, -tag, \ + jls:a:See The Java™ Language Specification:) $$(call AddOption, -Xdoclint:$$($1_DOCLINT)) ifneq ($$($1_DOCLINT_PACKAGES), ) $$(call AddOption, -Xdoclint/package:$$(call CommaList, $$($1_DOCLINT_PACKAGES))) @@ -309,13 +278,10 @@ define SetupJavadocGenerationBody $$(call AddOption, --system, none) $$(call AddOption, --module-source-path, $$(subst ",, $$(call PathList, $$(JAVADOC_SOURCE_DIRS)))) $$(call AddOption, --add-modules, $$(call CommaList, $$($1_MODULES))) - $$(call AddOption, -encoding, $$($1_ENCODING)) - ifneq ($$($1_NODEPRECATEDLIST), ) - $$(call AddOption, -nodeprecatedlist) - endif - ifneq ($$($1_BREAKITERATOR), ) - $$(call AddOption, -breakiterator) - endif + $$(call AddOption, -encoding, ISO-8859-1) + $$(call AddOption, -breakiterator) + $$(call AddOption, -serialwarn) + $$(call AddOption, -notimestamp) ifneq ($$($1_SPLIT_INDEX), ) $$(call AddOption, -splitIndex) endif @@ -325,17 +291,7 @@ define SetupJavadocGenerationBody $$(call AddOption, -doctitle, $$($1_DOC_TITLE)) $$(call AddOption, -windowtitle, $$($1_WINDOW_TITLE) $$(DRAFT_WINTITLE)) $$(call AddOption, -header, $$($1_HEADER)$$(DRAFT_HEADER)) - ifneq ($$($1_NOINDEX), ) - $$(call AddOption, -nonavbar) - $$(call AddOption, -noindex) - endif - ifneq ($$($1_EXTRA_TOP_2), ) - $$(call AddOption, -top,$$($1_EXTRA_TOP_2)) - endif $$(call AddOption, -bottom, $$($1_BOTTOM)$$(DRAFT_BOTTOM)) - ifneq ($$($1_PACKAGE_FILTER), ) - $$(call AddOption, -group, Packages, $$($1_PACKAGE_FILTER)) - endif ifneq ($$($1_RELATIVE_CORE_DIR), ) $$(call AddOption, -linkoffline, $$($1_RELATIVE_CORE_DIR)/api, $$(JAVADOC_OUTPUTDIR)/api/) endif @@ -367,232 +323,34 @@ endef ################################################################################ -CORE_PACKAGES := \ - java.applet \ - java.awt \ - java.awt.color \ - java.awt.datatransfer \ - java.awt.desktop \ - java.awt.dnd \ - java.awt.event \ - java.awt.font \ - java.awt.geom \ - java.awt.im \ - java.awt.im.spi \ - java.awt.image \ - java.awt.image.renderable \ - java.awt.print \ - java.beans \ - java.beans.beancontext \ - java.io \ - java.lang \ - java.lang.annotation \ - java.lang.instrument \ - java.lang.invoke \ - java.lang.management \ - java.lang.module \ - java.lang.ref \ - java.lang.reflect \ - java.math \ - java.net \ - java.net.http \ - java.net.spi \ - java.nio \ - java.nio.channels \ - java.nio.channels.spi \ - java.nio.charset \ - java.nio.charset.spi \ - java.nio.file \ - java.nio.file.attribute \ - java.nio.file.spi \ - java.rmi \ - java.rmi.activation \ - java.rmi.dgc \ - java.rmi.registry \ - java.rmi.server \ - java.security \ - java.security.acl \ - java.security.cert \ - java.security.interfaces \ - java.security.spec \ - java.sql \ - java.text \ - java.text.spi \ - java.time \ - java.time.chrono \ - java.time.format \ - java.time.temporal \ - java.time.zone \ - java.util \ - java.util.concurrent \ - java.util.concurrent.atomic \ - java.util.concurrent.locks \ - java.util.function \ - java.util.jar \ - java.util.logging \ - java.util.prefs \ - java.util.regex \ - java.util.spi \ - java.util.stream \ - java.util.zip \ - javax.accessibility \ - javax.activation \ - javax.activity \ - javax.annotation \ - javax.annotation.processing \ - javax.crypto \ - javax.crypto.interfaces \ - javax.crypto.spec \ - javax.imageio \ - javax.imageio.event \ - javax.imageio.metadata \ - javax.imageio.plugins.jpeg \ - javax.imageio.plugins.bmp \ - javax.imageio.plugins.tiff \ - javax.imageio.spi \ - javax.imageio.stream \ - javax.jws \ - javax.jws.soap \ - javax.lang.model \ - javax.lang.model.element \ - javax.lang.model.type \ - javax.lang.model.util \ - javax.management \ - javax.management.loading \ - javax.management.monitor \ - javax.management.relation \ - javax.management.openmbean \ - javax.management.timer \ - javax.management.modelmbean \ - javax.management.remote \ - javax.management.remote.rmi \ - javax.naming \ - javax.naming.directory \ - javax.naming.event \ - javax.naming.ldap \ - javax.naming.spi \ - javax.net \ - javax.net.ssl \ - javax.print \ - javax.print.attribute \ - javax.print.attribute.standard \ - javax.print.event \ - javax.rmi \ - javax.rmi.CORBA \ - javax.rmi.ssl \ - javax.script \ - javax.security.auth \ - javax.security.auth.callback \ - javax.security.auth.kerberos \ - javax.security.auth.login \ - javax.security.auth.spi \ - javax.security.auth.x500 \ - javax.security.cert \ - javax.security.sasl \ - javax.sound.sampled \ - javax.sound.sampled.spi \ - javax.sound.midi \ - javax.sound.midi.spi \ - javax.sql \ - javax.sql.rowset \ - javax.sql.rowset.serial \ - javax.sql.rowset.spi \ - javax.swing \ - javax.swing.border \ - javax.swing.colorchooser \ - javax.swing.filechooser \ - javax.swing.event \ - javax.swing.table \ - javax.swing.text \ - javax.swing.text.html \ - javax.swing.text.html.parser \ - javax.swing.text.rtf \ - javax.swing.tree \ - javax.swing.undo \ - javax.swing.plaf \ - javax.swing.plaf.basic \ - javax.swing.plaf.metal \ - javax.swing.plaf.multi \ - javax.swing.plaf.nimbus \ - javax.swing.plaf.synth \ - javax.tools \ - javax.transaction \ - javax.transaction.xa \ - javax.xml.catalog \ - javax.xml.parsers \ - javax.xml.bind \ - javax.xml.bind.annotation \ - javax.xml.bind.annotation.adapters \ - javax.xml.bind.attachment \ - javax.xml.bind.helpers \ - javax.xml.bind.util \ - javax.xml.soap \ - javax.xml.ws \ - javax.xml.ws.handler \ - javax.xml.ws.handler.soap \ - javax.xml.ws.http \ - javax.xml.ws.soap \ - javax.xml.ws.spi \ - javax.xml.ws.spi.http \ - javax.xml.ws.wsaddressing \ - javax.xml.transform \ - javax.xml.transform.sax \ - javax.xml.transform.dom \ - javax.xml.transform.stax \ - javax.xml.transform.stream \ - javax.xml \ - javax.xml.crypto \ - javax.xml.crypto.dom \ - javax.xml.crypto.dsig \ - javax.xml.crypto.dsig.dom \ - javax.xml.crypto.dsig.keyinfo \ - javax.xml.crypto.dsig.spec \ - javax.xml.datatype \ - javax.xml.validation \ - javax.xml.namespace \ - javax.xml.xpath \ - javax.xml.stream \ - javax.xml.stream.events \ - javax.xml.stream.util \ - org.ietf.jgss \ - org.omg.CORBA \ - org.omg.CORBA.DynAnyPackage \ - org.omg.CORBA.ORBPackage \ - org.omg.CORBA.TypeCodePackage \ - org.omg.stub.java.rmi \ - org.omg.CORBA.portable \ - org.omg.CORBA_2_3 \ - org.omg.CORBA_2_3.portable \ - org.omg.CosNaming \ - org.omg.CosNaming.NamingContextExtPackage \ - org.omg.CosNaming.NamingContextPackage \ - org.omg.SendingContext \ - org.omg.PortableServer \ - org.omg.PortableServer.CurrentPackage \ - org.omg.PortableServer.POAPackage \ - org.omg.PortableServer.POAManagerPackage \ - org.omg.PortableServer.ServantLocatorPackage \ - org.omg.PortableServer.portable \ - org.omg.PortableInterceptor \ - org.omg.PortableInterceptor.ORBInitInfoPackage \ - org.omg.Messaging \ - org.omg.IOP \ - org.omg.IOP.CodecFactoryPackage \ - org.omg.IOP.CodecPackage \ - org.omg.Dynamic \ - org.omg.DynamicAny \ - org.omg.DynamicAny.DynAnyPackage \ - org.omg.DynamicAny.DynAnyFactoryPackage \ - org.w3c.dom \ - org.w3c.dom.events \ - org.w3c.dom.bootstrap \ - org.w3c.dom.ls \ - org.w3c.dom.ranges \ - org.w3c.dom.traversal \ - org.w3c.dom.views \ - org.xml.sax \ - org.xml.sax.ext \ - org.xml.sax.helpers +# Core packages are all packages beginning with java, javax or org, except a few +# excludes. + +ALL_PKG_DIRS := $(dir $(filter %.java, $(call CacheFind, \ + $(wildcard $(JAVADOC_SOURCE_DIRS))))) +ALL_SRC_PREFIXES := $(addsuffix /%, $(wildcard $(JAVADOC_SOURCE_DIRS))) +ALL_PKG_DIRNAMES := $(foreach prefix, $(ALL_SRC_PREFIXES), \ + $(patsubst $(prefix),%, $(filter $(prefix), $(ALL_PKG_DIRS)))) +ALL_PACKAGES := $(sort $(subst /,., $(patsubst %/, %, $(ALL_PKG_DIRNAMES)))) + +JAVA_PACKAGES := $(filter java.%, $(ALL_PACKAGES)) +JAVAX_PACKAGES := $(filter javax.%, $(ALL_PACKAGES)) +ORG_PACKAGES := $(filter org.%, $(ALL_PACKAGES)) + +# Allow custom makefile to add more excluded packages +CORE_EXCLUDED_PACKAGES += \ + java.awt.dnd.peer \ + java.awt.peer \ + javax.smartcardio \ + org.jcp.xml.dsig.internal% \ + org.w3c.dom.css \ + org.w3c.dom.html \ + org.w3c.dom.stylesheets \ + org.w3c.dom.xpath \ + # + +CORE_PACKAGES := $(filter-out $(CORE_EXCLUDED_PACKAGES), \ + $(JAVA_PACKAGES) $(JAVAX_PACKAGES) $(ORG_PACKAGES)) $(eval $(call SetupJavadocGeneration, coredocs, \ MODULES := java.se.ee, \ @@ -600,13 +358,12 @@ $(eval $(call SetupJavadocGeneration, coredocs, \ IS_CORE := TRUE, \ OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html, \ WINDOW_TITLE := Java Platform SE $(VERSION_SPECIFICATION), \ - HEADER_TITLE := Java$(TRADEMARK) Platform
    Standard Ed. $(VERSION_SPECIFICATION), \ - DOC_TITLE := Java$(TRADEMARK) Platform$(COMMA) Standard Edition \ + HEADER_TITLE := Java™ Platform
    Standard Ed. $(VERSION_SPECIFICATION), \ + DOC_TITLE := Java™ Platform$(COMMA) Standard Edition \ $(VERSION_SPECIFICATION)
    API Specification, \ FIRST_COPYRIGHT_YEAR := 1993, \ - DOCLINT := reference, \ + DISABLED_DOCLINT := accessibility html missing syntax, \ DOCLINT_PACKAGES := -org.omg.* jdk.internal.logging.*, \ - ENCODING := ISO-8859-1, \ SPLIT_INDEX := TRUE, \ BOTTOM_COPYRIGHT_URL := $(CORE_BOTTOM_COPYRIGHT_URL), \ BOTTOM_TEXT := $(CORE_BOTTOM_TEXT), \ @@ -623,14 +380,10 @@ $(eval $(call SetupJavadocGeneration, docletapi, \ jdk.javadoc.doclet \ jdk.javadoc.doclet.taglet \ jdk.javadoc.doclets, \ - PACKAGE_FILTER := jdk.javadoc.doclet*, \ API_ROOT := jdk, \ DEST_DIR := javadoc/doclet, \ TITLE := Doclet API, \ FIRST_COPYRIGHT_YEAR := 1993, \ - BREAKITERATOR := TRUE, \ - BOTTOM_ADDRESS := $(COMMON_BOTTOM_ADDRESS), \ - BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT), \ )) TARGETS += $(docletapi) @@ -640,36 +393,23 @@ TARGETS += $(docletapi) $(eval $(call SetupJavadocGeneration, old-docletapi, \ MODULES := jdk.javadoc, \ PACKAGES := com.sun.javadoc, \ - PACKAGE_FILTER := com.sun.javadoc, \ API_ROOT := jdk, \ DEST_DIR := javadoc/old/doclet, \ TITLE := Doclet API, \ FIRST_COPYRIGHT_YEAR := 1993, \ - BREAKITERATOR := TRUE, \ - BOTTOM_ADDRESS := $(COMMON_BOTTOM_ADDRESS), \ - BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT), \ )) TARGETS += $(old-docletapi) ################################################################################ -# Specify a single class instead of a package -TAGLET_PACKAGE_SINGLE_CLASS := com/sun/tools/doclets/Taglet.java -TAGLET_PACKAGE_DIR := $(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes - $(eval $(call SetupJavadocGeneration, tagletapi, \ MODULES := jdk.javadoc, \ PACKAGES := com.sun.tools.doclets, \ - PACKAGES_SINGLE_CLASS := $(TAGLET_PACKAGE_DIR)/$(TAGLET_PACKAGE_SINGLE_CLASS), \ API_ROOT := jdk, \ DEST_DIR := javadoc/old/taglet, \ TITLE := Taglet API, \ FIRST_COPYRIGHT_YEAR := 1993, \ - BREAKITERATOR := TRUE, \ - NOINDEX := TRUE, \ - BOTTOM_ADDRESS := $(COMMON_BOTTOM_ADDRESS), \ - BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT), \ )) TARGETS += $(tagletapi) @@ -691,15 +431,12 @@ $(eval $(call SetupJavadocGeneration, domapi, \ org.w3c.dom.css \ org.w3c.dom.events \ org.w3c.dom.views, \ - PACKAGE_FILTER := org.w3c.dom*, \ API_ROOT := jre, \ DEST_DIR := plugin/dom, \ TITLE := Common DOM API, \ FIRST_COPYRIGHT_YEAR := 2005, \ - DOCLINT := none, \ + DISABLED_DOCLINT := accessibility html missing, \ SPLIT_INDEX := TRUE, \ - BOTTOM_ADDRESS := $(COMMON_BOTTOM_ADDRESS), \ - BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT), \ )) TARGETS += $(domapi) @@ -717,9 +454,10 @@ $(eval $(call SetupJavadocGeneration, jdi, \ API_ROOT := jdk, \ DEST_DIR := jpda/jdi, \ OVERVIEW := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/jdi-overview.html, \ - TITLE := Java$(TRADEMARK) Debug Interface, \ + TITLE := Java™ Debug Interface, \ FIRST_COPYRIGHT_YEAR := 1999, \ - DOCLINT := none, \ + DISABLED_DOCLINT := accessibility missing syntax, \ + SPLIT_INDEX := TRUE, \ )) TARGETS += $(jdi) @@ -736,9 +474,9 @@ $(eval $(call SetupJavadocGeneration, jaas, \ API_ROOT := jre, \ DEST_DIR := security/jaas/spec, \ OVERVIEW := $(JDK_TOPDIR)/src/jdk.security.auth/share/classes/jaas-overview.html, \ - TITLE := Java$(TRADEMARK) Authentication and Authorization Service, \ + TITLE := Java™ Authentication and Authorization Service, \ FIRST_COPYRIGHT_YEAR := 1998, \ - DOCLINT := none, \ + DISABLED_DOCLINT := missing, \ )) TARGETS += $(jaas) @@ -751,10 +489,8 @@ $(eval $(call SetupJavadocGeneration, jgss, \ API_ROOT := jre, \ DEST_DIR := security/jgss/spec, \ OVERVIEW := $(JDK_TOPDIR)/src/java.security.jgss/share/classes/jgss-overview.html, \ - TITLE := Java$(TRADEMARK) GSS-API Utilities, \ + TITLE := Java™ GSS-API Utilities, \ FIRST_COPYRIGHT_YEAR := 2000, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ )) TARGETS += $(jgss) @@ -766,10 +502,8 @@ $(eval $(call SetupJavadocGeneration, smartcardio, \ PACKAGES := javax.smartcardio, \ API_ROOT := jre, \ DEST_DIR := security/smartcardio/spec, \ - TITLE := Java$(TRADEMARK) Smart Card I/O, \ + TITLE := Java™ Smart Card I/O, \ FIRST_COPYRIGHT_YEAR := 2005, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ )) TARGETS += $(smartcardio) @@ -783,10 +517,9 @@ $(eval $(call SetupJavadocGeneration, httpserver, \ com.sun.net.httpserver.spi, \ API_ROOT := jre, \ DEST_DIR := net/httpserver/spec, \ - TITLE := Java$(TRADEMARK) HTTP Server, \ + TITLE := Java™ HTTP Server, \ FIRST_COPYRIGHT_YEAR := 2005, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ + DISABLED_DOCLINT := accessibility missing syntax, \ )) TARGETS += $(httpserver) @@ -799,9 +532,7 @@ $(eval $(call SetupJavadocGeneration, jsobject, \ API_ROOT := jre, \ DEST_DIR := plugin/jsobject, \ FIRST_COPYRIGHT_YEAR := 1993, \ - TITLE := Java$(TRADEMARK) JSObject Doc, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ + TITLE := Java™ JSObject Doc, \ )) TARGETS += $(jsobject) @@ -814,10 +545,9 @@ $(eval $(call SetupJavadocGeneration, mgmt, \ API_ROOT := jre, \ DEST_DIR := management/extension, \ OVERVIEW := $(JDK_TOPDIR)/src/java.management/share/classes/mgmt-overview.html, \ - TITLE := Monitoring and Management Interface for the Java$(TRADEMARK) Platform, \ + TITLE := Monitoring and Management Interface for the Java™ Platform, \ FIRST_COPYRIGHT_YEAR := 2003, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ + DISABLED_DOCLINT := accessibility missing reference, \ )) TARGETS += $(mgmt) @@ -833,8 +563,7 @@ $(eval $(call SetupJavadocGeneration, attach, \ DEST_DIR := attach/spec, \ TITLE := Attach API, \ FIRST_COPYRIGHT_YEAR := 2005, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ + DISABLED_DOCLINT := reference, \ )) TARGETS += $(attach) @@ -848,15 +577,12 @@ $(eval $(call SetupJavadocGeneration, jconsole, \ DEST_DIR := jconsole/spec, \ TITLE := JConsole API, \ FIRST_COPYRIGHT_YEAR := 2006, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ )) TARGETS += $(jconsole) ################################################################################ -# NOTE: Need to override RELATIVE_CORE_DIR to be bug compatible with old code. $(eval $(call SetupJavadocGeneration, jshellapi, \ MODULES := jdk.jshell, \ PACKAGES := \ @@ -865,10 +591,8 @@ $(eval $(call SetupJavadocGeneration, jshellapi, \ jdk.jshell.execution, \ API_ROOT := jdk, \ DEST_DIR := jshell, \ - RELATIVE_CORE_DIR := ../../../.., \ OVERVIEW := $(LANGTOOLS_TOPDIR)/src/jdk.jshell/share/classes/jdk/jshell/overview.html, \ TITLE := JShell API, \ - HEADER_TITLE := JSHELL API, \ FIRST_COPYRIGHT_YEAR := 2015, \ )) @@ -882,11 +606,11 @@ $(eval $(call SetupJavadocGeneration, treeapi, \ com.sun.source.doctree \ com.sun.source.tree \ com.sun.source.util, \ - PACKAGE_FILTER := com.sun.source.*, \ API_ROOT := jdk, \ DEST_DIR := javac/tree, \ TITLE := Compiler Tree API, \ FIRST_COPYRIGHT_YEAR := 2005, \ + SPLIT_INDEX := TRUE, \ )) TARGETS += $(treeapi) @@ -898,11 +622,11 @@ $(eval $(call SetupJavadocGeneration, nashornapi, \ PACKAGES := \ jdk.nashorn.api.scripting \ jdk.nashorn.api.tree, \ - PACKAGE_FILTER := jdk.nashorn.api.*, \ API_ROOT := jdk, \ DEST_DIR := nashorn, \ TITLE := Nashorn API, \ FIRST_COPYRIGHT_YEAR := 2014, \ + SPLIT_INDEX := TRUE, \ )) TARGETS += $(nashornapi) @@ -934,8 +658,6 @@ $(eval $(call SetupJavadocGeneration, sctp, \ DEST_DIR := nio/sctp/spec, \ TITLE := SCTP API, \ FIRST_COPYRIGHT_YEAR := 2009, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ )) TARGETS += $(sctp) @@ -949,7 +671,6 @@ $(eval $(call SetupJavadocGeneration, jaccess, \ DEST_DIR := accessibility/jaccess/spec, \ TITLE := JACCESS API, \ FIRST_COPYRIGHT_YEAR := 2002, \ - NODEPRECATEDLIST := TRUE, \ )) TARGETS += $(jaccess) @@ -963,8 +684,7 @@ $(eval $(call SetupJavadocGeneration, jdknet, \ DEST_DIR := net/socketoptions/spec, \ TITLE := jdk.net API, \ FIRST_COPYRIGHT_YEAR := 2014, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ + DISABLED_DOCLINT := missing, \ )) TARGETS += $(jdknet) @@ -980,8 +700,7 @@ $(eval $(call SetupJavadocGeneration, jlinkplugins, \ DEST_DIR := jlink, \ TITLE := JLink Plugin API - EXPERIMENTAL, \ FIRST_COPYRIGHT_YEAR := 2015, \ - DOCLINT := none, \ - NODEPRECATEDLIST := TRUE, \ + DISABLED_DOCLINT := html missing syntax, \ )) TARGETS += $(jlinkplugins) diff --git a/make/common/CORE_PKGS.gmk b/make/common/CORE_PKGS.gmk deleted file mode 100644 index 96c77123372..00000000000 --- a/make/common/CORE_PKGS.gmk +++ /dev/null @@ -1,305 +0,0 @@ -# -# Copyright (c) 2001, 2016, 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. -# - -# EXCLUDE_PKGS is the list of packages to exclude from the -# Java API Specification. Do not add these to CORE_PKGS. -# The concatenation of EXCLUDE_PKGS and CORE_PKGS -# should make up the list of all packages under the -# src/shared/classes directory of the JDK source tree. -# -EXCLUDE_PKGS = \ - java.awt.peer \ - java.awt.dnd.peer \ - sun.* \ - com.sun.* \ - org.apache.* \ - org.jcp.* \ - org.w3c.dom.css \ - org.w3c.dom.html \ - org.w3c.dom.stylesheets \ - org.omg.stub.javax.management.remote.rmi - -# -# ACTIVE_JSR_PKGS are packages that are part of an active JSR process-- -# one that is doing its own review. These packages are not included when -# creating diff pages for the platform's JCP process. -# -# (see /java/pubs/apisrc/jdk/6.0/beta/make/docs/active_jsr_pkgs) -# Note: -# This is a list of regular expressions. So foo.* matches "foo" and "foo.bar". -# -ACTIVE_JSR_PKGS= \ - java.lang.invoke \ - java.sql \ - javax.activation \ - javax.annotation.* \ - javax.jws.* \ - javax.lang.* \ - javax.management.* \ - javax.script \ - javax.sql.* \ - javax.tools.* \ - javax.xml.* \ - org.w3c.* \ - org.xml.sax - -# -# CORE_PKGS is the list of packages that form the -# Java API Specification. -# -### ***IMPORTANT NOTE*** -### There is also a "REGEXP" variable in the docs/makefile that -### determines which table the packages go in on the main page. -### Currently, there is only table ("Platform Packages") and -### everything goes in it, so REGEXP is "*". But if that policy -### changes, packages added will need to be reflected in that -### list of wildcard expressions, as well. -### -CORE_PKGS = \ - java.applet \ - java.awt \ - java.awt.color \ - java.awt.datatransfer \ - java.awt.desktop \ - java.awt.dnd \ - java.awt.event \ - java.awt.font \ - java.awt.geom \ - java.awt.im \ - java.awt.im.spi \ - java.awt.image \ - java.awt.image.renderable \ - java.awt.print \ - java.beans \ - java.beans.beancontext \ - java.io \ - java.lang \ - java.lang.annotation \ - java.lang.instrument \ - java.lang.invoke \ - java.lang.management \ - java.lang.module \ - java.lang.ref \ - java.lang.reflect \ - java.math \ - java.net \ - java.net.http \ - java.net.spi \ - java.nio \ - java.nio.channels \ - java.nio.channels.spi \ - java.nio.charset \ - java.nio.charset.spi \ - java.nio.file \ - java.nio.file.attribute \ - java.nio.file.spi \ - java.rmi \ - java.rmi.activation \ - java.rmi.dgc \ - java.rmi.registry \ - java.rmi.server \ - java.security \ - java.security.acl \ - java.security.cert \ - java.security.interfaces \ - java.security.spec \ - java.sql \ - java.text \ - java.text.spi \ - java.time \ - java.time.chrono \ - java.time.format \ - java.time.temporal \ - java.time.zone \ - java.util \ - java.util.concurrent \ - java.util.concurrent.atomic \ - java.util.concurrent.locks \ - java.util.function \ - java.util.jar \ - java.util.logging \ - java.util.prefs \ - java.util.regex \ - java.util.spi \ - java.util.stream \ - java.util.zip \ - javax.accessibility \ - javax.activation \ - javax.activity \ - javax.annotation \ - javax.annotation.processing \ - javax.crypto \ - javax.crypto.interfaces \ - javax.crypto.spec \ - javax.imageio \ - javax.imageio.event \ - javax.imageio.metadata \ - javax.imageio.plugins.jpeg \ - javax.imageio.plugins.bmp \ - javax.imageio.plugins.tiff \ - javax.imageio.spi \ - javax.imageio.stream \ - javax.jws \ - javax.jws.soap \ - javax.lang.model \ - javax.lang.model.element \ - javax.lang.model.type \ - javax.lang.model.util \ - javax.management \ - javax.management.loading \ - javax.management.monitor \ - javax.management.relation \ - javax.management.openmbean \ - javax.management.timer \ - javax.management.modelmbean \ - javax.management.remote \ - javax.management.remote.rmi \ - javax.naming \ - javax.naming.directory \ - javax.naming.event \ - javax.naming.ldap \ - javax.naming.spi \ - javax.net \ - javax.net.ssl \ - javax.print \ - javax.print.attribute \ - javax.print.attribute.standard \ - javax.print.event \ - javax.rmi \ - javax.rmi.CORBA \ - javax.rmi.ssl \ - javax.script \ - javax.security.auth \ - javax.security.auth.callback \ - javax.security.auth.kerberos \ - javax.security.auth.login \ - javax.security.auth.spi \ - javax.security.auth.x500 \ - javax.security.cert \ - javax.security.sasl \ - javax.sound.sampled \ - javax.sound.sampled.spi \ - javax.sound.midi \ - javax.sound.midi.spi \ - javax.sql \ - javax.sql.rowset \ - javax.sql.rowset.serial \ - javax.sql.rowset.spi \ - javax.swing \ - javax.swing.border \ - javax.swing.colorchooser \ - javax.swing.filechooser \ - javax.swing.event \ - javax.swing.table \ - javax.swing.text \ - javax.swing.text.html \ - javax.swing.text.html.parser \ - javax.swing.text.rtf \ - javax.swing.tree \ - javax.swing.undo \ - javax.swing.plaf \ - javax.swing.plaf.basic \ - javax.swing.plaf.metal \ - javax.swing.plaf.multi \ - javax.swing.plaf.nimbus \ - javax.swing.plaf.synth \ - javax.tools \ - javax.transaction \ - javax.transaction.xa \ - javax.xml.catalog \ - javax.xml.parsers \ - javax.xml.bind \ - javax.xml.bind.annotation \ - javax.xml.bind.annotation.adapters \ - javax.xml.bind.attachment \ - javax.xml.bind.helpers \ - javax.xml.bind.util \ - javax.xml.soap \ - javax.xml.ws \ - javax.xml.ws.handler \ - javax.xml.ws.handler.soap \ - javax.xml.ws.http \ - javax.xml.ws.soap \ - javax.xml.ws.spi \ - javax.xml.ws.spi.http \ - javax.xml.ws.wsaddressing \ - javax.xml.transform \ - javax.xml.transform.sax \ - javax.xml.transform.dom \ - javax.xml.transform.stax \ - javax.xml.transform.stream \ - javax.xml \ - javax.xml.crypto \ - javax.xml.crypto.dom \ - javax.xml.crypto.dsig \ - javax.xml.crypto.dsig.dom \ - javax.xml.crypto.dsig.keyinfo \ - javax.xml.crypto.dsig.spec \ - javax.xml.datatype \ - javax.xml.validation \ - javax.xml.namespace \ - javax.xml.xpath \ - javax.xml.stream \ - javax.xml.stream.events \ - javax.xml.stream.util \ - org.ietf.jgss \ - org.omg.CORBA \ - org.omg.CORBA.DynAnyPackage \ - org.omg.CORBA.ORBPackage \ - org.omg.CORBA.TypeCodePackage \ - org.omg.stub.java.rmi \ - org.omg.CORBA.portable \ - org.omg.CORBA_2_3 \ - org.omg.CORBA_2_3.portable \ - org.omg.CosNaming \ - org.omg.CosNaming.NamingContextExtPackage \ - org.omg.CosNaming.NamingContextPackage \ - org.omg.SendingContext \ - org.omg.PortableServer \ - org.omg.PortableServer.CurrentPackage \ - org.omg.PortableServer.POAPackage \ - org.omg.PortableServer.POAManagerPackage \ - org.omg.PortableServer.ServantLocatorPackage \ - org.omg.PortableServer.portable \ - org.omg.PortableInterceptor \ - org.omg.PortableInterceptor.ORBInitInfoPackage \ - org.omg.Messaging \ - org.omg.IOP \ - org.omg.IOP.CodecFactoryPackage \ - org.omg.IOP.CodecPackage \ - org.omg.Dynamic \ - org.omg.DynamicAny \ - org.omg.DynamicAny.DynAnyPackage \ - org.omg.DynamicAny.DynAnyFactoryPackage \ - org.w3c.dom \ - org.w3c.dom.events \ - org.w3c.dom.bootstrap \ - org.w3c.dom.ls \ - org.w3c.dom.ranges \ - org.w3c.dom.traversal \ - org.w3c.dom.views \ - org.xml.sax \ - org.xml.sax.ext \ - org.xml.sax.helpers diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index c54d7f5c640..9c2a3f135d1 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -121,6 +121,10 @@ endef # any present escapes before escaping so that no double escapes are added. EscapeDollar = $(subst $$,\$$,$(subst \$$,$$,$(strip $1))) +################################################################################ +# This macro works just like EscapeDollar above, but for #. +EscapeHash = $(subst \#,\\\#,$(subst \\\#,\#,$(strip $1))) + ################################################################################ # This macro translates $ into $$ to protect the string from make itself. DoubleDollar = $(subst $$,$$$$,$(strip $1)) @@ -833,7 +837,7 @@ DependOnVariableHelper = \ $(if $(findstring $(LOG_LEVEL), trace), \ $(info NewVariable $1: >$(strip $($1))<) \ $(info OldVariable $1: >$(strip $($1_old))<)) \ - $(call WriteFile, $1_old:=$(call DoubleDollar,$($1)), \ + $(call WriteFile, $1_old:=$(call DoubleDollar,$(call EscapeHash,$($1))), \ $(call DependOnVariableFileName, $1, $2))) \ $(call DependOnVariableFileName, $1, $2) \ ) diff --git a/make/common/NON_CORE_PKGS.gmk b/make/common/NON_CORE_PKGS.gmk deleted file mode 100644 index 26a387a5e90..00000000000 --- a/make/common/NON_CORE_PKGS.gmk +++ /dev/null @@ -1,132 +0,0 @@ -# -# Copyright (c) 2002, 2016, 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. -# - -# -# This file contains the package names of all the "non-core" -# API published in the Java 2 SDK documentation. "Non-core" means -# it includes all published API outside of the JDK API specification. -# -# These environment variables are used by javadoc in -# make/docs/Makefile and are referenced by the localization -# team when determining which APIs to extract javadoc -# comments from. - -DOMAPI_PKGS = org.w3c.dom \ - org.w3c.dom.bootstrap \ - org.w3c.dom.ls \ - org.w3c.dom.ranges \ - org.w3c.dom.traversal \ - org.w3c.dom.html \ - org.w3c.dom.stylesheets \ - org.w3c.dom.css \ - org.w3c.dom.events \ - org.w3c.dom.views - -JDI_PKGS = com.sun.jdi \ - com.sun.jdi.event \ - com.sun.jdi.request \ - com.sun.jdi.connect \ - com.sun.jdi.connect.spi - -MGMT_PKGS = com.sun.management - -JAAS_PKGS = com.sun.security.auth \ - com.sun.security.auth.callback \ - com.sun.security.auth.login \ - com.sun.security.auth.module - -JGSS_PKGS = com.sun.security.jgss - -OLD_JSSE_PKGS = com.sun.net.ssl - -HTTPSERVER_PKGS = com.sun.net.httpserver \ - com.sun.net.httpserver.spi - -NIO_PKGS = com.sun.nio.file - -OLD_DOCLETAPI_PKGS = com.sun.javadoc - -DOCLETAPI_PKGS = jdk.javadoc.doclet \ - jdk.javadoc.doclet.taglet \ - jdk.javadoc.doclets - -TAGLETAPI_FILE = com/sun/tools/doclets/Taglet.java - -TAGLETAPI_PKGS = com.sun.tools.doclets - -ATTACH_PKGS = com.sun.tools.attach \ - com.sun.tools.attach.spi - -JCONSOLE_PKGS = com.sun.tools.jconsole - -JSHELLAPI_PKGS = jdk.jshell \ - jdk.jshell.spi \ - jdk.jshell.execution - -TREEAPI_PKGS = com.sun.source.doctree \ - com.sun.source.tree \ - com.sun.source.util - -NASHORNAPI_PKGS = jdk.nashorn.api.scripting \ - jdk.nashorn.api.tree - -DYNALINKAPI_PKGS = jdk.dynalink \ - jdk.dynalink.beans \ - jdk.dynalink.linker \ - jdk.dynalink.linker.support \ - jdk.dynalink.support - -SMARTCARDIO_PKGS = javax.smartcardio - -SCTPAPI_PKGS = com.sun.nio.sctp - -ifeq ($(PLATFORM), macosx) - APPLE_EXT_PKGS = com.apple.eawt \ - com.apple.eawt.event \ - com.apple.eio -endif - -JDK_PKGS = jdk \ - jdk.net \ - jdk.management.cmm - -JACCESSAPI_PKGS = com.sun.java.accessibility.util - -JSOBJECT_PKGS = netscape.javascript - -# non-core packages in rt.jar -NON_CORE_PKGS = $(DOMAPI_PKGS) \ - $(JSOBJECT_PKGS) \ - $(MGMT_PKGS) \ - $(JAAS_PKGS) \ - $(JGSS_PKGS) \ - $(NIO_PKGS) \ - $(OLD_JSSE_PKGS) \ - $(HTTPSERVER_PKGS) \ - $(SMARTCARDIO_PKGS) \ - $(SCTPAPI_PKGS) \ - $(APPLE_EXT_PKGS) \ - $(JDK_PKGS) \ - $(JACCESSAPI_PKGS) diff --git a/test/make/TestMakeBase.gmk b/test/make/TestMakeBase.gmk index 547041b03f5..0bed3ea447c 100644 --- a/test/make/TestMakeBase.gmk +++ b/test/make/TestMakeBase.gmk @@ -226,10 +226,11 @@ $(eval $(call assert-equals, $(VARDEP_TEST_VAR2_old), $(VARDEP_TEST_VAR2), \ Wrong contents in vardeps file)) # Test with a variable value containing some problematic characters -VARDEP_TEST_VAR3 := foo '""' "''" bar \$$ORIGIN +VARDEP_TEST_VAR3 := foo '""' "''" bar \$$ORIGIN &\#x00a9 VARDEP_VALUE_FILE := $(call DependOnVariable, VARDEP_TEST_VAR3) -include $(VARDEP_VALUE_FILE) -$(eval $(call assert-equals, $(VARDEP_TEST_VAR3_old), $(VARDEP_TEST_VAR3), \ +$(eval $(call assert-equals, $(call EscapeHash,$(VARDEP_TEST_VAR3_old)), \ + $(call EscapeHash,$(VARDEP_TEST_VAR3)), \ Wrong contents in vardep file)) TEST_TARGETS += test-vardep From 25a65593b781ed02f1ea98b9505688efed8b6e36 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 22 Nov 2016 13:44:41 +0100 Subject: [PATCH 53/54] 8170077: Properly parallelize javadoc generation Reviewed-by: erikj --- make/Javadoc.gmk | 333 +++++++++++++++++++++-------------------------- 1 file changed, 150 insertions(+), 183 deletions(-) diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index 8a0a4cf0fd6..807fafb6092 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -50,11 +50,6 @@ JAVADOC_SOURCE_DIRS = \ # Should we use -Xdocrootparent? Allow custom to overwrite. DOCROOTPARENT_FLAG = TRUE -# The core api index file is the target for the core api javadocs rule -# and needs to be defined early so that all other javadoc rules may -# depend on it. -CORE_INDEX_FILE := $(JAVADOC_OUTPUTDIR)/api/index.html - # URLs JAVADOC_BASE_URL := http://docs.oracle.com/javase/$(VERSION_SPECIFICATION)/docs BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/ @@ -70,52 +65,82 @@ COMMON_BOTTOM_TEXT := $(BUG_SUBMIT_LINE)
    Java is a trademark or registered \ trademark of $(FULL_COMPANY_NAME) in the US and other countries. CORE_BOTTOM_COPYRIGHT_URL := {@docroot}/../legal/cpyr.html -CORE_BOTTOM_TEXT := $(BUG_SUBMIT_LINE) \ -
    For further API reference and developer documentation, see \ -Java SE \ -Documentation. That documentation contains more detailed, \ -developer-targeted descriptions, with conceptual overviews, definitions of \ -terms, workarounds, and working code examples. +CORE_BOTTOM_TEXT := \ + $(BUG_SUBMIT_LINE) \ +
    For further API reference and developer documentation, see \ + Java SE \ + Documentation. That documentation contains more detailed, \ + developer-targeted descriptions, with conceptual overviews, definitions of \ + terms, workarounds, and working code examples. ifeq ($(VERSION_IS_GA), true) - DRAFT_HEADER := - DRAFT_BOTTOM := - DRAFT_WINTITLE := - CORE_TOP_EARLYACCESS := + DRAFT_MARKER := + DRAFT_WINDOW_TITLE_MARKER := + EARLYACCESS_TOP := else # We need a draft format when not building the GA version. - DRAFT_HEADER :=
    DRAFT $(VERSION_STRING) - DRAFT_BOTTOM :=
    DRAFT $(VERSION_STRING) + DRAFT_MARKER :=
    DRAFT $(VERSION_STRING) ifeq ($(VERSION_BUILD), 0) - DRAFT_WINTITLE := [ad-hoc build] + DRAFT_WINDOW_TITLE_MARKER := $(SPACE)[ad-hoc build] else - DRAFT_WINTITLE := [build $(VERSION_BUILD)] + DRAFT_WINDOW_TITLE_MARKER := $(SPACE)[build $(VERSION_BUILD)] endif - CORE_TOP_EARLYACCESS := \ -
    \ -
    \ -Please note that the specifications and other information contained herein are \ -not final and are subject to change. The information is being made available \ -to you solely for purpose of evaluation.
    + EARLYACCESS_TOP := \ +
    Please note that the specifications \ + and other information contained herein are not final and are subject to \ + change. The information is being made available to you solely for \ + purpose of evaluation.
    endif +################################################################################ +# Special treatment for the core package list. All separate "small" javadoc +# invocation needs to be able to see the core package list. + +ALL_PKG_DIRS := $(dir $(filter %.java, $(call CacheFind, \ + $(wildcard $(JAVADOC_SOURCE_DIRS))))) +ALL_SRC_PREFIXES := $(addsuffix /%, $(wildcard $(JAVADOC_SOURCE_DIRS))) +ALL_PKG_DIRNAMES := $(foreach prefix, $(ALL_SRC_PREFIXES), \ + $(patsubst $(prefix),%, $(filter $(prefix), $(ALL_PKG_DIRS)))) +ALL_PACKAGES := $(sort $(subst /,., $(patsubst %/, %, $(ALL_PKG_DIRNAMES)))) + +# Core packages are all packages beginning with java, javax or org, except a few +# excludes. +JAVA_PACKAGES := $(filter java.%, $(ALL_PACKAGES)) +JAVAX_PACKAGES := $(filter javax.%, $(ALL_PACKAGES)) +ORG_PACKAGES := $(filter org.%, $(ALL_PACKAGES)) + +# Allow custom makefile to add more excluded packages +CORE_EXCLUDED_PACKAGES += \ + java.awt.dnd.peer \ + java.awt.peer \ + javax.smartcardio \ + org.jcp.xml.dsig.internal% \ + org.w3c.dom.css \ + org.w3c.dom.html \ + org.w3c.dom.stylesheets \ + org.w3c.dom.xpath \ + # + +CORE_PACKAGES := $(filter-out $(CORE_EXCLUDED_PACKAGES), \ + $(JAVA_PACKAGES) $(JAVAX_PACKAGES) $(ORG_PACKAGES)) + +CORE_PACKAGES_LIST_DIR := $(SUPPORT_OUTPUTDIR)/docs/core-packages +CORE_PACKAGES_LIST_FILE := $(CORE_PACKAGES_LIST_DIR)/package-list + +CORE_PACKAGES_VARDEPS_FILE := $(call DependOnVariable, CORE_PACKAGES, \ + $(CORE_PACKAGES_LIST_FILE).vardeps) + +$(CORE_PACKAGES_LIST_FILE): $(CORE_PACKAGES_VARDEPS_FILE) + $(call MakeDir, $(@D)) + $(eval $(call ListPathsSafely, CORE_PACKAGES, $@)) + ################################################################################ # Support functions for SetupJavadocGeneration -# Print an option line to the target file -# Arguments: -# arg 1: the option name -# arg 2-3: optional arguments to the option -define AddOption - $(PRINTF) "%s$(if $(strip $2), '%s',)$(if $(strip $3), '%s',)\n" \ - "$(strip $1)"$(if $(strip $2), '$(strip $2)',)$(if $(strip $3), \ - '$(strip $3)',) >> $@ -endef - -# This function goes to great pains to exactly mimic the old behavior -# in all details, including whitespace. +# Generate the text used in the -bottom argument. # Note that COPYRIGHT_YEAR is the current year (from spec.gmk) # Arguments: # arg 1: first copyright year @@ -131,6 +156,34 @@ endef # Speed up finding by filling cache $(eval $(call FillCacheFind, $(wildcard $(JAVADOC_SOURCE_DIRS)))) +# In order to get a specific ordering it's necessary to specify the total +# ordering of tags as the tags are otherwise ordered in order of definition. +DEFAULT_JAVADOC_TAGS := \ + -tag beaninfo:X \ + -tag revised:X \ + -tag since.unbundled:X \ + -tag spec:X \ + -tag specdefault:X \ + -tag Note:X \ + -tag ToDo:X \ + -tag 'apiNote:a:API Note:' \ + -tag 'implSpec:a:Implementation Requirements:' \ + -tag 'implNote:a:Implementation Note:' \ + -tag param \ + -tag return \ + -tag throws \ + -tag since \ + -tag version \ + -tag serialData \ + -tag factory \ + -tag see \ + -tag 'jvms:a:See The Java™ Virtual Machine Specification:' \ + -tag 'jls:a:See The Java™ Language Specification:' \ + # + +DEFAULT_JAVADOC_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \ + -serialwarn -encoding ISO-8859-1 -breakiterator --system none + ################################################################################ # Setup make rules for running javadoc. # @@ -171,151 +224,100 @@ define SetupJavadocGenerationBody # The non-core api javadocs need to be able to access the root of the core # api directory, so for jdk/api or jre/api to get to the core api/ # directory we would use this - $1_RELATIVE_CORE_DIR := $$(strip $$(subst $$(call DirToDotDot, \ - $$(JAVADOC_OUTPUTDIR))/,, $$(call DirToDotDot, \ - $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)))) + $1_RELATIVE_CORE_DIR := $$(call DirToDotDot, $$($1_OUTPUT_DIRNAME))/api - $1_DEPS += $(CORE_INDEX_FILE) + # We need to tell javadoc the directory in which to find the core package-list + $1_OPTIONS += -linkoffline $$($1_RELATIVE_CORE_DIR) $$(CORE_PACKAGES_LIST_DIR) + + $1_DEPS += $(CORE_PACKAGES_LIST_FILE) endif - ifneq ($$($1_OVERVIEW), ) - $1_DEPS += $$($1_OVERVIEW) + $1_OPTIONS += --add-modules $$(call CommaList, $$($1_MODULES)) + + ifneq ($$(LOG_LEVEL), trace) + $1_OPTIONS += -quiet endif - ifeq ($$($1_DISABLED_DOCLINT), ) - $1_DOCLINT := all - else - # Create a string like "all,-syntax,-html" - $1_DOCLINT := all,$$(call CommaList, $$(addprefix -, $$($1_DISABLED_DOCLINT))) + ifneq ($$($1_DISABLED_DOCLINT), ) + # Create a string like ",-syntax,-html" + $1_DOCLINT_EXCEPTIONS := ,$$(call CommaList, $$(addprefix -, $$($1_DISABLED_DOCLINT))) + endif + $1_OPTIONS += -Xdoclint:all$$($1_DOCLINT_EXCEPTIONS) + + ifneq ($$($1_DOCLINT_PACKAGES), ) + $1_OPTIONS += -Xdoclint/package:$$(call CommaList, $$($1_DOCLINT_PACKAGES)) endif ifeq ($$($1_DOC_TITLE), ) $1_DOC_TITLE := $$($1_TITLE) endif + $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)' ifeq ($$($1_WINDOW_TITLE), ) $1_WINDOW_TITLE := $$(strip $$(subst ™,, $$($1_TITLE))) endif + $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)$$(DRAFT_WINDOW_TITLE_MARKER)' ifeq ($$($1_HEADER_TITLE), ) $1_HEADER_TITLE := $$(strip $$(subst ™,, $$($1_TITLE))) endif - $1_HEADER := $$($1_HEADER_TITLE) + $1_OPTIONS += -header '$$($1_HEADER_TITLE)$$(DRAFT_MARKER)' + + ifneq ($$($1_EXTRA_TOP), ) + $1_OPTIONS += -top '$$($1_EXTRA_TOP)' + endif ifeq ($$($1_BOTTOM_TEXT), ) $1_BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT) endif - $1_BOTTOM := $$(call GenerateBottom, $$($1_FIRST_COPYRIGHT_YEAR), \ $$($1_BOTTOM_COPYRIGHT_URL), $$($1_BOTTOM_TEXT)) + $1_OPTIONS += -bottom '$$($1_BOTTOM)$$(DRAFT_MARKER)' - # The index.html, options, and packages files - $1_INDEX_FILE := $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)/index.html - $1_OPTIONS_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.options - $1_PACKAGES_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.packages + ifneq ($$($1_OVERVIEW), ) + $1_OPTIONS += -overview $$($1_OVERVIEW) + $1_DEPS += $$($1_OVERVIEW) + endif - $1_PACKAGES_VARDEPS := $$($1_PACKAGES) - $1_PACKAGES_VARDEPS_FILE := $$(call DependOnVariable, $1_PACKAGES_VARDEPS, \ - $$($1_PACKAGES_FILE).vardeps) + ifneq ($$($1_SPLIT_INDEX), ) + $1_OPTIONS += -splitIndex + endif - # Rule for creating a file with the package names in it - $$($1_PACKAGES_FILE): $$($1_PACKAGES_VARDEPS_FILE) - $$(call LogInfo, Creating Javadoc package file for $1) - $$(call MakeDir, $$(@D)) - $$(ECHO) $$($1_PACKAGES) | $$(TR) ' ' '\n' > $$@ + ifneq ($$($DOCROOTPARENT_FLAG), ) + $1_OPTIONS += -Xdocrootparent $(JAVADOC_BASE_URL) + endif - $1_OPTIONS_VARDEPS := $$($1_EXTRA_TOP) \ - $$($DOCROOTPARENT_FLAG) $$(JAVADOC_BASE_URL) $$($1_DISABLED_DOCLINT) \ - $$($1_DOCLINT_PACKAGES) $$(JAVADOC_SOURCE_DIRS) $$($1_MODULES) \ - $$($1_SPLIT_INDEX) $$($1_OVERVIEW) $$($1_DOC_TITLE) $$($1_WINDOW_TITLE) \ - $$(DRAFT_WINTITLE) $$($1_HEADER) $$(DRAFT_HEADER) $$($1_BOTTOM) \ - $$(DRAFT_BOTTOM)) $$($1_RELATIVE_CORE_DIR) $$(JAVADOC_OUTPUTDIR) - $1_OPTIONS_VARDEPS_FILE := $$(call DependOnVariable, $1_OPTIONS_VARDEPS, \ - $$($1_OPTIONS_FILE).vardeps) - - # Rule for creating a file with javadoc options in it - $$($1_OPTIONS_FILE): $$($1_OPTIONS_VARDEPS_FILE) - $$(call LogInfo, Creating Javadoc options file for $1) - $$(call MakeDir, $$(@D)) - $$(RM) $$@ - $$(call AddOption, -XDignore.symbol.file=true) - ifneq ($$(LOG_LEVEL), trace) - $$(call AddOption, -quiet) - endif - $$(call AddOption, -use) - $$(call AddOption, -keywords) - ifneq ($$($DOCROOTPARENT_FLAG), ) - $$(call AddOption, -Xdocrootparent, $(JAVADOC_BASE_URL)) - endif - # In order to get a specific ordering it's necessary to specify the total - # ordering of tags as the tags are otherwise ordered in order of definition. - $$(call AddOption, -tag, beaninfo:X) - $$(call AddOption, -tag, revised:X) - $$(call AddOption, -tag, since.unbundled:X) - $$(call AddOption, -tag, spec:X) - $$(call AddOption, -tag, specdefault:X) - $$(call AddOption, -tag, Note:X) - $$(call AddOption, -tag, ToDo:X) - $$(call AddOption, -tag, apiNote:a:API Note:) - $$(call AddOption, -tag, implSpec:a:Implementation Requirements:) - $$(call AddOption, -tag, implNote:a:Implementation Note:) - $$(call AddOption, -tag, param) - $$(call AddOption, -tag, return) - $$(call AddOption, -tag, throws) - $$(call AddOption, -tag, since) - $$(call AddOption, -tag, version) - $$(call AddOption, -tag, serialData) - $$(call AddOption, -tag, factory) - $$(call AddOption, -tag, see) - $$(call AddOption, -tag, \ - jvms:a:See The Java™ Virtual Machine Specification:) - $$(call AddOption, -tag, \ - jls:a:See The Java™ Language Specification:) - $$(call AddOption, -Xdoclint:$$($1_DOCLINT)) - ifneq ($$($1_DOCLINT_PACKAGES), ) - $$(call AddOption, -Xdoclint/package:$$(call CommaList, $$($1_DOCLINT_PACKAGES))) - endif - $$(call AddOption, --system, none) - $$(call AddOption, --module-source-path, $$(subst ",, $$(call PathList, $$(JAVADOC_SOURCE_DIRS)))) - $$(call AddOption, --add-modules, $$(call CommaList, $$($1_MODULES))) - $$(call AddOption, -encoding, ISO-8859-1) - $$(call AddOption, -breakiterator) - $$(call AddOption, -serialwarn) - $$(call AddOption, -notimestamp) - ifneq ($$($1_SPLIT_INDEX), ) - $$(call AddOption, -splitIndex) - endif - ifneq ($$($1_OVERVIEW), ) - $$(call AddOption, -overview, $$($1_OVERVIEW)) - endif - $$(call AddOption, -doctitle, $$($1_DOC_TITLE)) - $$(call AddOption, -windowtitle, $$($1_WINDOW_TITLE) $$(DRAFT_WINTITLE)) - $$(call AddOption, -header, $$($1_HEADER)$$(DRAFT_HEADER)) - $$(call AddOption, -bottom, $$($1_BOTTOM)$$(DRAFT_BOTTOM)) - ifneq ($$($1_RELATIVE_CORE_DIR), ) - $$(call AddOption, -linkoffline, $$($1_RELATIVE_CORE_DIR)/api, $$(JAVADOC_OUTPUTDIR)/api/) - endif - ifneq ($$($1_EXTRA_TOP), ) - $$(call AddOption, -top, $$($1_EXTRA_TOP)) - endif + $1_VARDEPS := $$($1_OPTIONS) $$($1_PACKAGES) + $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ + $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps) $1_PACKAGE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach p, \ $$(subst .,/,$$(strip $$($1_PACKAGES))), \ $$(addsuffix /$$p, $$(wildcard $$(JAVADOC_SOURCE_DIRS)))))) + # If there are many packages, use an @-file... + ifneq ($$(word 17, $$($1_PACKAGES)), ) + $1_PACKAGES_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.packages + $1_PACKAGES_ARG := @$$($1_PACKAGES_FILE) + else + $1_PACKAGES_ARG := $$($1_PACKAGES) + endif + + # The index.html which is a marker for all the output from javadoc. + $1_INDEX_FILE := $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)/index.html + # Rule for actually running javadoc - $$($1_INDEX_FILE): $$($1_OPTIONS_FILE) $$($1_PACKAGES_FILE) \ - $$($1_PACKAGE_DEPS) $$($1_DEPS) - $$(call LogWarn, Generating Javadoc for $$($1_OUTPUT_DIRNAME)) + $$($1_INDEX_FILE): $$($1_VARDEPS_FILE) $$($1_PACKAGE_DEPS) $$($1_DEPS) + $$(call LogWarn, Generating Javadoc from $$(words $$($1_PACKAGES)) package(s) for $$($1_OUTPUT_DIRNAME)) $$(call MakeDir, $$(@D)) - ifneq ($$(findstring $$(LOG_LEVEL), debug trace),) - $$(ECHO) "Contents of $$($1_OPTIONS_FILE):" `$$(CAT) $$($1_OPTIONS_FILE)` - $$(ECHO) "Contents of $$($1_PACKAGES_FILE):" `$$(CAT) $$($1_PACKAGES_FILE)` + ifneq ($$($1_PACKAGES_FILE), ) + $$(eval $$(call ListPathsSafely, $1_PACKAGES, $$($1_PACKAGES_FILE))) endif $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1.javadoc, \ $$($1_JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) -d $$(@D) \ - @$$($1_OPTIONS_FILE) @$$($1_PACKAGES_FILE)) - $$(TOUCH) $$($1_INDEX_FILE) + $$(DEFAULT_JAVADOC_TAGS) $$(DEFAULT_JAVADOC_OPTIONS) \ + --module-source-path $$(call PathList, $$(JAVADOC_SOURCE_DIRS)) \ + $$($1_OPTIONS) $$($1_PACKAGES_ARG)) # The output returned will be the index.html file $1 := $$($1_INDEX_FILE) @@ -323,35 +325,6 @@ endef ################################################################################ -# Core packages are all packages beginning with java, javax or org, except a few -# excludes. - -ALL_PKG_DIRS := $(dir $(filter %.java, $(call CacheFind, \ - $(wildcard $(JAVADOC_SOURCE_DIRS))))) -ALL_SRC_PREFIXES := $(addsuffix /%, $(wildcard $(JAVADOC_SOURCE_DIRS))) -ALL_PKG_DIRNAMES := $(foreach prefix, $(ALL_SRC_PREFIXES), \ - $(patsubst $(prefix),%, $(filter $(prefix), $(ALL_PKG_DIRS)))) -ALL_PACKAGES := $(sort $(subst /,., $(patsubst %/, %, $(ALL_PKG_DIRNAMES)))) - -JAVA_PACKAGES := $(filter java.%, $(ALL_PACKAGES)) -JAVAX_PACKAGES := $(filter javax.%, $(ALL_PACKAGES)) -ORG_PACKAGES := $(filter org.%, $(ALL_PACKAGES)) - -# Allow custom makefile to add more excluded packages -CORE_EXCLUDED_PACKAGES += \ - java.awt.dnd.peer \ - java.awt.peer \ - javax.smartcardio \ - org.jcp.xml.dsig.internal% \ - org.w3c.dom.css \ - org.w3c.dom.html \ - org.w3c.dom.stylesheets \ - org.w3c.dom.xpath \ - # - -CORE_PACKAGES := $(filter-out $(CORE_EXCLUDED_PACKAGES), \ - $(JAVA_PACKAGES) $(JAVAX_PACKAGES) $(ORG_PACKAGES)) - $(eval $(call SetupJavadocGeneration, coredocs, \ MODULES := java.se.ee, \ PACKAGES := $(CORE_PACKAGES), \ @@ -367,7 +340,7 @@ $(eval $(call SetupJavadocGeneration, coredocs, \ SPLIT_INDEX := TRUE, \ BOTTOM_COPYRIGHT_URL := $(CORE_BOTTOM_COPYRIGHT_URL), \ BOTTOM_TEXT := $(CORE_BOTTOM_TEXT), \ - EXTRA_TOP := $(CORE_TOP_EARLYACCESS), \ + EXTRA_TOP := $(EARLYACCESS_TOP), \ )) TARGETS += $(coredocs) @@ -733,19 +706,13 @@ COPY_TARGETS += $(COPY_JVMTI_HTML) ################################################################################ # Optional target which bundles all generated javadocs into a zip archive. -# The dependency on docs is handled in Main.gmk. - -# Add the core docs as prerequisite to the archive to trigger a rebuild -# if the core docs were rebuilt. Ideally any doc rebuild should trigger -# this, but the way prerequisites are currently setup in this file, that -# is hard to achieve. JAVADOC_ARCHIVE_NAME := jdk-$(VERSION_STRING)-docs.zip JAVADOC_ARCHIVE_ASSEMBLY_DIR := $(SUPPORT_OUTPUTDIR)/docs/zip-docs JAVADOC_ARCHIVE_DIR := $(OUTPUT_ROOT)/bundles JAVADOC_ARCHIVE := $(JAVADOC_ARCHIVE_DIR)/$(JAVADOC_ARCHIVE_NAME) -$(JAVADOC_ARCHIVE): $(CORE_INDEX_FILE) +$(JAVADOC_ARCHIVE): $(TARGETS) $(COPY_TARGETS) $(call LogInfo, Compressing javadoc to single $(JAVADOC_ARCHIVE_NAME)) $(MKDIR) -p $(JAVADOC_ARCHIVE_DIR) $(RM) -r $(JAVADOC_ARCHIVE_ASSEMBLY_DIR) From 3da21ba32eab3aa9ca7bf8dea0a67f5fc86fee71 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 22 Nov 2016 14:47:52 +0100 Subject: [PATCH 54/54] 8168037: Use ZIPEXE instead of ZIP to avoid clash with options for zip Reviewed-by: erikj --- common/autoconf/basics.m4 | 4 +- common/autoconf/generated-configure.sh | 106 +++++++++++++------------ common/autoconf/spec.gmk.in | 3 +- make/Bundles.gmk | 4 +- make/Javadoc.gmk | 2 +- make/Jprt.gmk | 6 +- make/common/JarArchive.gmk | 2 +- make/common/NativeCompilation.gmk | 2 +- make/common/ZipArchive.gmk | 2 +- 9 files changed, 67 insertions(+), 64 deletions(-) diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index 7f8c42f6b98..9d5789e37ca 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -1048,7 +1048,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], # These tools might not be installed by default, # need hint on how to install them. BASIC_REQUIRE_PROGS(UNZIP, unzip) - BASIC_REQUIRE_PROGS(ZIP, zip) + # Since zip uses "ZIP" as a environment variable for passing options, we need + # to name our variable differently, hence ZIPEXE. + BASIC_REQUIRE_PROGS(ZIPEXE, zip) # Non-required basic tools diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 238387046d6..55e9e3f4eca 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -945,7 +945,7 @@ HG READELF OTOOL LDD -ZIP +ZIPEXE UNZIP TAR_SUPPORTS_TRANSFORM TAR_INCLUDE_PARAM @@ -1292,7 +1292,7 @@ CPIO NICE MAKE UNZIP -ZIP +ZIPEXE LDD OTOOL READELF @@ -2236,7 +2236,7 @@ Some influential environment variables: NICE Override default value for NICE MAKE Override default value for MAKE UNZIP Override default value for UNZIP - ZIP Override default value for ZIP + ZIPEXE Override default value for ZIPEXE LDD Override default value for LDD OTOOL Override default value for OTOOL READELF Override default value for READELF @@ -5093,7 +5093,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1479120453 +DATE_WHEN_GENERATED=1479822431 ############################################################################### # @@ -21373,13 +21373,15 @@ $as_echo "$tool_specified" >&6; } fi + # Since zip uses "ZIP" as a environment variable for passing options, we need + # to name our variable differently, hence ZIPEXE. # Publish this variable in the help. - if [ -z "${ZIP+x}" ]; then + if [ -z "${ZIPEXE+x}" ]; then # The variable is not set by user, try to locate tool using the code snippet for ac_prog in zip do @@ -21387,12 +21389,12 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ZIP+:} false; then : +if ${ac_cv_path_ZIPEXE+:} false; then : $as_echo_n "(cached) " >&6 else - case $ZIP in + case $ZIPEXE in [\\/]* | ?:[\\/]*) - ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path. + ac_cv_path_ZIPEXE="$ZIPEXE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -21402,7 +21404,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_ZIPEXE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -21413,30 +21415,30 @@ IFS=$as_save_IFS ;; esac fi -ZIP=$ac_cv_path_ZIP -if test -n "$ZIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5 -$as_echo "$ZIP" >&6; } +ZIPEXE=$ac_cv_path_ZIPEXE +if test -n "$ZIPEXE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIPEXE" >&5 +$as_echo "$ZIPEXE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$ZIP" && break + test -n "$ZIPEXE" && break done else # The variable is set, but is it from the command line or the environment? - # Try to remove the string !ZIP! from our list. - try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!ZIP!/} + # Try to remove the string !ZIPEXE! from our list. + try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!ZIPEXE!/} if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then # If it failed, the variable was not from the command line. Ignore it, # but warn the user (except for BASH, which is always set by the calling BASH). - if test "xZIP" != xBASH; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of ZIP from the environment. Use command line variables instead." >&5 -$as_echo "$as_me: WARNING: Ignoring value of ZIP from the environment. Use command line variables instead." >&2;} + if test "xZIPEXE" != xBASH; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of ZIPEXE from the environment. Use command line variables instead." >&5 +$as_echo "$as_me: WARNING: Ignoring value of ZIPEXE from the environment. Use command line variables instead." >&2;} fi # Try to locate tool using the code snippet for ac_prog in zip @@ -21445,12 +21447,12 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ZIP+:} false; then : +if ${ac_cv_path_ZIPEXE+:} false; then : $as_echo_n "(cached) " >&6 else - case $ZIP in + case $ZIPEXE in [\\/]* | ?:[\\/]*) - ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path. + ac_cv_path_ZIPEXE="$ZIPEXE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -21460,7 +21462,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_ZIPEXE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -21471,17 +21473,17 @@ IFS=$as_save_IFS ;; esac fi -ZIP=$ac_cv_path_ZIP -if test -n "$ZIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5 -$as_echo "$ZIP" >&6; } +ZIPEXE=$ac_cv_path_ZIPEXE +if test -n "$ZIPEXE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIPEXE" >&5 +$as_echo "$ZIPEXE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$ZIP" && break + test -n "$ZIPEXE" && break done else @@ -21493,31 +21495,31 @@ done CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var" # Check if we try to supply an empty value - if test "x$ZIP" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool ZIP= (no value)" >&5 -$as_echo "$as_me: Setting user supplied tool ZIP= (no value)" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIP" >&5 -$as_echo_n "checking for ZIP... " >&6; } + if test "x$ZIPEXE" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool ZIPEXE= (no value)" >&5 +$as_echo "$as_me: Setting user supplied tool ZIPEXE= (no value)" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIPEXE" >&5 +$as_echo_n "checking for ZIPEXE... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } else # Check if the provided tool contains a complete path. - tool_specified="$ZIP" + tool_specified="$ZIPEXE" tool_basename="${tool_specified##*/}" if test "x$tool_basename" = "x$tool_specified"; then # A command without a complete path is provided, search $PATH. - { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool ZIP=$tool_basename" >&5 -$as_echo "$as_me: Will search for user supplied tool ZIP=$tool_basename" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool ZIPEXE=$tool_basename" >&5 +$as_echo "$as_me: Will search for user supplied tool ZIPEXE=$tool_basename" >&6;} # Extract the first word of "$tool_basename", so it can be a program name with args. set dummy $tool_basename; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ZIP+:} false; then : +if ${ac_cv_path_ZIPEXE+:} false; then : $as_echo_n "(cached) " >&6 else - case $ZIP in + case $ZIPEXE in [\\/]* | ?:[\\/]*) - ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path. + ac_cv_path_ZIPEXE="$ZIPEXE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -21527,7 +21529,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_ZIPEXE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -21538,29 +21540,29 @@ IFS=$as_save_IFS ;; esac fi -ZIP=$ac_cv_path_ZIP -if test -n "$ZIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5 -$as_echo "$ZIP" >&6; } +ZIPEXE=$ac_cv_path_ZIPEXE +if test -n "$ZIPEXE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIPEXE" >&5 +$as_echo "$ZIPEXE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ZIP" = x; then + if test "x$ZIPEXE" = x; then as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5 fi else # Otherwise we believe it is a complete path. Use it as it is. - { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool ZIP=$tool_specified" >&5 -$as_echo "$as_me: Will use user supplied tool ZIP=$tool_specified" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIP" >&5 -$as_echo_n "checking for ZIP... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool ZIPEXE=$tool_specified" >&5 +$as_echo "$as_me: Will use user supplied tool ZIPEXE=$tool_specified" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIPEXE" >&5 +$as_echo_n "checking for ZIPEXE... " >&6; } if test ! -x "$tool_specified"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } - as_fn_error $? "User supplied tool ZIP=$tool_specified does not exist or is not executable" "$LINENO" 5 + as_fn_error $? "User supplied tool ZIPEXE=$tool_specified does not exist or is not executable" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5 $as_echo "$tool_specified" >&6; } @@ -21572,8 +21574,8 @@ $as_echo "$tool_specified" >&6; } - if test "x$ZIP" = x; then - as_fn_error $? "Could not find required tool for ZIP" "$LINENO" 5 + if test "x$ZIPEXE" = x; then + as_fn_error $? "Could not find required tool for ZIPEXE" "$LINENO" 5 fi diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index e2d7be936f6..1d7cdf263ed 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -657,8 +657,7 @@ TOUCH:=@TOUCH@ UNIQ:=@UNIQ@ WC:=@WC@ XARGS:=@XARGS@ -ZIPEXE:=@ZIP@ -ZIP:=@ZIP@ +ZIPEXE:=@ZIPEXE@ UNZIP:=@UNZIP@ MT:=@FIXPATH@ @MT@ RC:=@FIXPATH@ @RC@ diff --git a/make/Bundles.gmk b/make/Bundles.gmk index 989eb4aae69..5fa35e1ac6f 100644 --- a/make/Bundles.gmk +++ b/make/Bundles.gmk @@ -101,7 +101,7 @@ define SetupBundleFileBody ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) $$($1_SUBDIR) $(TAR_IGNORE_EXIT_VALUE) ) \ | $(GZIP) > $$@ else ifeq ($$($1_TYPE), zip) - $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIP) -qr $$@ . + $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIPEXE) -qr $$@ . endif endif else @@ -113,7 +113,7 @@ define SetupBundleFileBody | $(GZIP) > $$@ else ifeq ($$($1_TYPE), zip) $(CD) $$($1_BASE_DIR) \ - && $(ZIP) -qr $$@ . -i@$(SUPPORT_OUTPUTDIR)/bundles/_$1_files + && $(ZIPEXE) -qr $$@ . -i@$(SUPPORT_OUTPUTDIR)/bundles/_$1_files endif endif diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index 807fafb6092..b8c4da332dc 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -724,7 +724,7 @@ $(JAVADOC_ARCHIVE): $(TARGETS) $(COPY_TARGETS) name=`$(ECHO) $${target_dir} | $(SED) "s;/spec;;" | $(SED) "s;.*/;;"`; \ $(LN) -s $${target_dir} $${name}; \ done; \ - $(ZIP) -q -r $(JAVADOC_ARCHIVE) * ; \ + $(ZIPEXE) -q -r $(JAVADOC_ARCHIVE) * ; \ popd ; ZIP_TARGETS += $(JAVADOC_ARCHIVE) diff --git a/make/Jprt.gmk b/make/Jprt.gmk index 411525a143b..d42f361e1c9 100644 --- a/make/Jprt.gmk +++ b/make/Jprt.gmk @@ -71,11 +71,11 @@ ifeq ($(JPRT_TARGET), $(DEFAULT_MAKE_TARGET)) # This target must be called in the context of a SPEC file $(JPRT_ARCHIVE_BUNDLE): product-images $(call MakeDir, $(@D)) - $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $@ . + $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIPEXE) -y -q -r $@ . $(JPRT_ARCHIVE_TEST_BUNDLE): test-image $(call MakeDir, $(@D)) - $(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r $@ . + $(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIPEXE) -y -q -r $@ . ############################################################################## # Optional symbols bundle @@ -85,7 +85,7 @@ ifeq ($(JPRT_TARGET), $(DEFAULT_MAKE_TARGET)) $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): product-images $(call MakeDir, $(@D)) - $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r $@ . + $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIPEXE) -y -q -r $@ . endif diff --git a/make/common/JarArchive.gmk b/make/common/JarArchive.gmk index 4ca2af1a413..1d6d45531f2 100644 --- a/make/common/JarArchive.gmk +++ b/make/common/JarArchive.gmk @@ -264,7 +264,7 @@ define SetupJarArchiveBody $(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) $$(NEWLINE) \ if [ -s $$($1_DELETESS_FILE) ]; then \ $(ECHO) " deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \ - $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \ + $(ZIPEXE) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \ fi $$(NEWLINE) \ $$($1_UPDATE_CONTENTS) true $$(NEWLINE) \ $$($1_JARINDEX) && true ) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index e94ea5e479e..36e0381facc 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -875,7 +875,7 @@ define SetupNativeCompilationBody # to be rebuilt properly. $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET) $(CD) $$($1_OUTPUT_DIR) && \ - $(ZIP) -q -r $$@ $$(subst $$($1_OUTPUT_DIR)/,, $$($1_DEBUGINFO_FILES)) + $(ZIPEXE) -q -r $$@ $$(subst $$($1_OUTPUT_DIR)/,, $$($1_DEBUGINFO_FILES)) endif endif # !STATIC_LIBRARY diff --git a/make/common/ZipArchive.gmk b/make/common/ZipArchive.gmk index 80fb28f48fe..79806dee0c9 100644 --- a/make/common/ZipArchive.gmk +++ b/make/common/ZipArchive.gmk @@ -107,7 +107,7 @@ define SetupZipArchiveBody $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) $(MKDIR) -p $$(@D) $(ECHO) Updating $$($1_NAME) - $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$($1_ZIP_OPTIONS) $$@ . $$($1_ZIP_INCLUDES) \ + $$(foreach i,$$($1_SRC),(cd $$i && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . $$($1_ZIP_INCLUDES) \ $$($1_ZIP_EXCLUDES) -x \*_the.\* \ $$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \ || test "$$$$?" = "12" )$$(NEWLINE)) true