# HG changeset patch # User sherman # Date 1526490730 25200 # Node ID aefd3c7f537373588d3751aa1b5777b72e1b9f73 # Parent 7db531b8366136fde4b3dd1d17d08892fab750dc 8191533: jar --describe-module prints service provider class names in lower case Reviewed-by: alanb diff -r 7db531b83661 -r aefd3c7f5373 src/jdk.jartool/share/classes/sun/tools/jar/Main.java --- a/src/jdk.jartool/share/classes/sun/tools/jar/Main.java Wed May 16 09:40:57 2018 -0700 +++ b/src/jdk.jartool/share/classes/sun/tools/jar/Main.java Wed May 16 10:12:10 2018 -0700 @@ -1911,12 +1911,16 @@ return true; } - static String toString(Collection set) { + static String toLowerCaseString(Collection set) { if (set.isEmpty()) { return ""; } return " " + set.stream().map(e -> e.toString().toLowerCase(Locale.ROOT)) .sorted().collect(joining(" ")); } + static String toString(Collection set) { + if (set.isEmpty()) { return ""; } + return " " + set.stream().map(e -> e.toString()).sorted().collect(joining(" ")); + } private void describeModule(InputStream entryInputStream, String uriString) throws IOException @@ -1952,12 +1956,14 @@ .sorted(Comparator.comparing(Exports::source)) .filter(e -> !e.isQualified()) .forEach(e -> sb.append("exports ").append(e.source()) - .append(toString(e.modifiers())).append("\n")); + .append(toLowerCaseString(e.modifiers())) + .append("\n")); // dependences md.requires().stream().sorted() .forEach(r -> sb.append("requires ").append(r.name()) - .append(toString(r.modifiers())).append("\n")); + .append(toLowerCaseString(r.modifiers())) + .append("\n")); // service use and provides md.uses().stream().sorted() @@ -1975,7 +1981,7 @@ .sorted(Comparator.comparing(Exports::source)) .filter(Exports::isQualified) .forEach(e -> sb.append("qualified exports ").append(e.source()) - .append(" to").append(toString(e.targets())) + .append(" to").append(toLowerCaseString(e.targets())) .append("\n")); // open packages @@ -1983,15 +1989,15 @@ .sorted(Comparator.comparing(Opens::source)) .filter(o -> !o.isQualified()) .forEach(o -> sb.append("opens ").append(o.source()) - .append(toString(o.modifiers())) + .append(toLowerCaseString(o.modifiers())) .append("\n")); md.opens().stream() .sorted(Comparator.comparing(Opens::source)) .filter(Opens::isQualified) .forEach(o -> sb.append("qualified opens ").append(o.source()) - .append(toString(o.modifiers())) - .append(" to").append(toString(o.targets())) + .append(toLowerCaseString(o.modifiers())) + .append(" to").append(toLowerCaseString(o.targets())) .append("\n")); // non-exported/non-open packages diff -r 7db531b83661 -r aefd3c7f5373 src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java --- a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java Wed May 16 09:40:57 2018 -0700 +++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java Wed May 16 10:12:10 2018 -0700 @@ -320,12 +320,17 @@ } } - static String toString(Collection c) { + static String toLowerCaseString(Collection c) { if (c.isEmpty()) { return ""; } return " " + c.stream().map(e -> e.toString().toLowerCase(Locale.ROOT)) .sorted().collect(joining(" ")); } + static String toString(Collection c) { + if (c.isEmpty()) { return ""; } + return " " + c.stream().map(e -> e.toString()).sorted().collect(joining(" ")); + } + private void describeModule(ModuleDescriptor md, ModuleTarget target, ModuleHashes hashes) @@ -346,12 +351,12 @@ .sorted(Comparator.comparing(Exports::source)) .filter(e -> !e.isQualified()) .forEach(e -> sb.append("exports ").append(e.source()) - .append(toString(e.modifiers())).append("\n")); + .append(toLowerCaseString(e.modifiers())).append("\n")); // dependences md.requires().stream().sorted() .forEach(r -> sb.append("requires ").append(r.name()) - .append(toString(r.modifiers())).append("\n")); + .append(toLowerCaseString(r.modifiers())).append("\n")); // service use and provides md.uses().stream().sorted() @@ -369,7 +374,7 @@ .sorted(Comparator.comparing(Exports::source)) .filter(Exports::isQualified) .forEach(e -> sb.append("qualified exports ").append(e.source()) - .append(" to").append(toString(e.targets())) + .append(" to").append(toLowerCaseString(e.targets())) .append("\n")); // open packages @@ -377,15 +382,15 @@ .sorted(Comparator.comparing(Opens::source)) .filter(o -> !o.isQualified()) .forEach(o -> sb.append("opens ").append(o.source()) - .append(toString(o.modifiers())) + .append(toLowerCaseString(o.modifiers())) .append("\n")); md.opens().stream() .sorted(Comparator.comparing(Opens::source)) .filter(Opens::isQualified) .forEach(o -> sb.append("qualified opens ").append(o.source()) - .append(toString(o.modifiers())) - .append(" to").append(toString(o.targets())) + .append(toLowerCaseString(o.modifiers())) + .append(" to").append(toLowerCaseString(o.targets())) .append("\n")); // non-exported/non-open packages diff -r 7db531b83661 -r aefd3c7f5373 test/jdk/tools/jar/modularJar/Basic.java --- a/test/jdk/tools/jar/modularJar/Basic.java Wed May 16 09:40:57 2018 -0700 +++ b/test/jdk/tools/jar/modularJar/Basic.java Wed May 16 10:12:10 2018 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, 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 @@ -46,7 +46,7 @@ /* * @test - * @bug 8167328 8171830 8165640 8174248 8176772 8196748 + * @bug 8167328 8171830 8165640 8174248 8176772 8196748 8191533 * @library /lib/testlibrary /test/lib * @modules jdk.compiler * jdk.jartool @@ -666,6 +666,17 @@ "-C", modClasses.toString(), "jdk/test/baz/BazService.class", "-C", modClasses.toString(), "jdk/test/baz/internal/BazServiceImpl.class") .assertSuccess(); + + for (String option : new String[] {"--describe-module", "-d" }) { + jar(option, + "--file=" + modularJar.toString()) + .assertSuccess() + .resultChecker(r -> + assertTrue(r.output.contains("provides jdk.test.baz.BazService with jdk.test.baz.internal.BazServiceImpl"), + "Expected to find ", "provides jdk.test.baz.BazService with jdk.test.baz.internal.BazServiceImpl", + " in [", r.output, "]") + ); + } } @Test