8191533: jar --describe-module prints service provider class names in lower case
Reviewed-by: alanb
This commit is contained in:
parent
ad3144f97f
commit
bd36be5066
@ -1911,12 +1911,16 @@ public class Main {
|
||||
return true;
|
||||
}
|
||||
|
||||
static <T> String toString(Collection<T> set) {
|
||||
static <T> String toLowerCaseString(Collection<T> set) {
|
||||
if (set.isEmpty()) { return ""; }
|
||||
return " " + set.stream().map(e -> e.toString().toLowerCase(Locale.ROOT))
|
||||
.sorted().collect(joining(" "));
|
||||
}
|
||||
|
||||
static <T> String toString(Collection<T> 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 @@ public class Main {
|
||||
.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 @@ public class Main {
|
||||
.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 @@ public class Main {
|
||||
.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
|
||||
|
@ -320,12 +320,17 @@ public class JmodTask {
|
||||
}
|
||||
}
|
||||
|
||||
static <T> String toString(Collection<T> c) {
|
||||
static <T> String toLowerCaseString(Collection<T> c) {
|
||||
if (c.isEmpty()) { return ""; }
|
||||
return " " + c.stream().map(e -> e.toString().toLowerCase(Locale.ROOT))
|
||||
.sorted().collect(joining(" "));
|
||||
}
|
||||
|
||||
static <T> String toString(Collection<T> 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 @@ public class JmodTask {
|
||||
.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 @@ public class JmodTask {
|
||||
.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 @@ public class JmodTask {
|
||||
.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
|
||||
|
@ -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 @@ import static java.lang.System.out;
|
||||
|
||||
/*
|
||||
* @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 @@ public class Basic {
|
||||
"-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
|
||||
|
Loading…
Reference in New Issue
Block a user