mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-20 12:53:29 +00:00
Merge
This commit is contained in:
commit
21aaeeffff
@ -84,6 +84,8 @@ public final class LangtoolsIdeaAntLogger extends DefaultLogger {
|
||||
JAVAC_WARNING(StringBinaryPredicate.CONTAINS, MSG_WARN, "warning:", "compiler.warn"),
|
||||
/** a javac note */
|
||||
JAVAC_NOTE(StringBinaryPredicate.CONTAINS, MSG_INFO, "note:", "compiler.note"),
|
||||
/** a javac raw error (these typically come from a build misconfiguration - such as a bad javac flag) */
|
||||
JAVAC_RAW_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "javac: "),
|
||||
/** continuation of some javac error message */
|
||||
JAVAC_NESTED_DIAG(StringBinaryPredicate.STARTS_WITH, MSG_INFO, " "),
|
||||
/** a javac crash */
|
||||
@ -126,7 +128,7 @@ public final class LangtoolsIdeaAntLogger extends DefaultLogger {
|
||||
enum Task {
|
||||
/** exec task - invoked during compilation */
|
||||
JAVAC("exec", MessageKind.JAVAC_ERROR, MessageKind.JAVAC_WARNING, MessageKind.JAVAC_NOTE,
|
||||
MessageKind.JAVAC_NESTED_DIAG, MessageKind.JAVAC_CRASH),
|
||||
MessageKind.JAVAC_RAW_ERROR, MessageKind.JAVAC_NESTED_DIAG, MessageKind.JAVAC_CRASH),
|
||||
/** jtreg task - invoked during test execution */
|
||||
JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, MessageKind.JTREG_TEST_ERROR, MessageKind.JTREG_TEST_REPORT),
|
||||
/** initial synthetic task when the logger is created */
|
||||
|
||||
@ -3845,20 +3845,26 @@ public class Types {
|
||||
return bounds.head;
|
||||
} else { // length > 1
|
||||
int classCount = 0;
|
||||
List<Type> cvars = List.nil();
|
||||
List<Type> lowers = List.nil();
|
||||
for (Type bound : bounds) {
|
||||
if (!bound.isInterface()) {
|
||||
classCount++;
|
||||
Type lower = cvarLowerBound(bound);
|
||||
if (bound != lower && !lower.hasTag(BOT))
|
||||
lowers = insert(lowers, lower);
|
||||
if (bound != lower && !lower.hasTag(BOT)) {
|
||||
cvars = cvars.append(bound);
|
||||
lowers = lowers.append(lower);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (classCount > 1) {
|
||||
if (lowers.isEmpty())
|
||||
if (lowers.isEmpty()) {
|
||||
return createErrorType(errT);
|
||||
else
|
||||
return glbFlattened(union(bounds, lowers), errT);
|
||||
} else {
|
||||
// try again with lower bounds included instead of capture variables
|
||||
List<Type> newBounds = bounds.diff(cvars).appendList(lowers);
|
||||
return glb(newBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
return makeIntersectionType(bounds);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1740,7 +1740,7 @@ public class JavacParser implements Parser {
|
||||
accept(ARROW);
|
||||
|
||||
return token.kind == LBRACE ?
|
||||
lambdaStatement(args, pos, pos) :
|
||||
lambdaStatement(args, pos, token.pos) :
|
||||
lambdaExpression(args, pos);
|
||||
}
|
||||
|
||||
|
||||
@ -2558,7 +2558,7 @@ compiler.err.default.methods.not.supported.in.source=\
|
||||
# 0: string
|
||||
compiler.err.intersection.types.in.cast.not.supported.in.source=\
|
||||
intersection types in cast are not supported in -source {0}\n\
|
||||
(use -source 8 or higher to enable default methods)
|
||||
(use -source 8 or higher to enable intersection types in cast)
|
||||
|
||||
# 0: string
|
||||
compiler.err.static.intf.methods.not.supported.in.source=\
|
||||
|
||||
@ -105,18 +105,18 @@ public class JdepsConfiguration implements AutoCloseable {
|
||||
// build root set for resolution
|
||||
Set<String> mods = new HashSet<>(roots);
|
||||
|
||||
// add default modules to the root set
|
||||
// unnamed module
|
||||
if (!initialArchives.isEmpty() || !classpaths.isEmpty() ||
|
||||
roots.isEmpty() || allDefaultModules) {
|
||||
mods.addAll(systemModulePath.defaultSystemRoots());
|
||||
}
|
||||
if (allSystemModules) {
|
||||
// add all system modules to the root set for unnamed module or set explicitly
|
||||
boolean unnamed = !initialArchives.isEmpty() || !classpaths.isEmpty();
|
||||
if (allSystemModules || (unnamed && !allDefaultModules)) {
|
||||
systemModulePath.findAll().stream()
|
||||
.map(mref -> mref.descriptor().name())
|
||||
.forEach(mods::add);
|
||||
}
|
||||
|
||||
if (allDefaultModules) {
|
||||
mods.addAll(systemModulePath.defaultSystemRoots());
|
||||
}
|
||||
|
||||
this.configuration = Configuration.empty()
|
||||
.resolveRequires(finder, ModuleFinder.of(), mods);
|
||||
|
||||
@ -502,6 +502,7 @@ public class JdepsConfiguration implements AutoCloseable {
|
||||
boolean addAllApplicationModules;
|
||||
boolean addAllDefaultModules;
|
||||
boolean addAllSystemModules;
|
||||
boolean allModules;
|
||||
Runtime.Version version;
|
||||
|
||||
public Builder() {
|
||||
@ -550,8 +551,7 @@ public class JdepsConfiguration implements AutoCloseable {
|
||||
* Include all system modules and modules found on modulepath
|
||||
*/
|
||||
public Builder allModules() {
|
||||
this.addAllSystemModules = true;
|
||||
this.addAllApplicationModules = true;
|
||||
this.allModules = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -592,19 +592,30 @@ public class JdepsConfiguration implements AutoCloseable {
|
||||
.map(mref -> mref.descriptor().name())
|
||||
.forEach(rootModules::add);
|
||||
}
|
||||
if (addAllApplicationModules && appModulePath != null) {
|
||||
|
||||
if ((addAllApplicationModules || allModules) && appModulePath != null) {
|
||||
appModulePath.findAll().stream()
|
||||
.map(mref -> mref.descriptor().name())
|
||||
.forEach(rootModules::add);
|
||||
}
|
||||
|
||||
// no archive is specified for analysis
|
||||
// add all system modules as root if --add-modules ALL-SYSTEM is specified
|
||||
if (addAllSystemModules && rootModules.isEmpty() &&
|
||||
initialArchives.isEmpty() && classPaths.isEmpty()) {
|
||||
systemModulePath.findAll()
|
||||
.stream()
|
||||
.map(mref -> mref.descriptor().name())
|
||||
.forEach(rootModules::add);
|
||||
}
|
||||
|
||||
return new JdepsConfiguration(systemModulePath,
|
||||
finder,
|
||||
rootModules,
|
||||
classPaths,
|
||||
initialArchives,
|
||||
addAllDefaultModules,
|
||||
addAllSystemModules,
|
||||
allModules,
|
||||
version);
|
||||
}
|
||||
|
||||
|
||||
@ -38,10 +38,10 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.ToIntFunction;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Implementation for the jdeps tool for static class dependency analysis.
|
||||
@ -314,7 +314,10 @@ class JdepsTask {
|
||||
},
|
||||
new Option(true, "-m", "--module") {
|
||||
void process(JdepsTask task, String opt, String arg) throws BadArgs {
|
||||
task.options.rootModule = arg;
|
||||
if (!task.options.rootModules.isEmpty()) {
|
||||
throw new BadArgs("err.option.already.specified", opt);
|
||||
}
|
||||
task.options.rootModules.add(arg);
|
||||
task.options.addmods.add(arg);
|
||||
}
|
||||
},
|
||||
@ -350,6 +353,7 @@ class JdepsTask {
|
||||
new Option(true, "--require") {
|
||||
void process(JdepsTask task, String opt, String arg) {
|
||||
task.options.requires.add(arg);
|
||||
task.options.addmods.add(arg);
|
||||
}
|
||||
},
|
||||
new Option(true, "-f", "-filter") {
|
||||
@ -491,11 +495,6 @@ class JdepsTask {
|
||||
if (options.help || options.version || options.fullVersion) {
|
||||
return EXIT_OK;
|
||||
}
|
||||
|
||||
if (!inputArgs.isEmpty() && options.rootModule != null) {
|
||||
reportError("err.invalid.arg.for.option", "-m");
|
||||
}
|
||||
|
||||
if (options.numFilters() > 1) {
|
||||
reportError("err.invalid.filters");
|
||||
return EXIT_CMDERR;
|
||||
@ -543,8 +542,8 @@ class JdepsTask {
|
||||
e.getKey(),
|
||||
e.getValue().toString())));
|
||||
|
||||
// check if any module specified in --require is missing
|
||||
Stream.concat(options.addmods.stream(), options.requires.stream())
|
||||
// check if any module specified in --add-modules, --require, and -m is missing
|
||||
options.addmods.stream()
|
||||
.filter(mn -> !config.isValidToken(mn))
|
||||
.forEach(mn -> config.findModule(mn).orElseThrow(() ->
|
||||
new UncheckedBadArgs(new BadArgs("err.module.not.found", mn))));
|
||||
@ -620,6 +619,7 @@ class JdepsTask {
|
||||
protected Command(CommandOption option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the command-line options are all valid;
|
||||
* otherwise, returns false.
|
||||
@ -633,6 +633,10 @@ class JdepsTask {
|
||||
|
||||
/**
|
||||
* Includes all modules on system module path and application module path
|
||||
*
|
||||
* When a named module is analyzed, it will analyze the dependences
|
||||
* only. The method should be overridden when this command should
|
||||
* analyze all modules instead.
|
||||
*/
|
||||
boolean allModules() {
|
||||
return false;
|
||||
@ -680,6 +684,10 @@ class JdepsTask {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inputArgs.isEmpty() && !options.rootModules.isEmpty()) {
|
||||
reportError("err.invalid.arg.for.option", "-m");
|
||||
}
|
||||
if (inputArgs.isEmpty() && !options.hasSourcePath()) {
|
||||
showHelp();
|
||||
return false;
|
||||
@ -808,23 +816,46 @@ class JdepsTask {
|
||||
log.println();
|
||||
if (!options.requires.isEmpty())
|
||||
log.println(getMessage("inverse.transitive.dependencies.on",
|
||||
options.requires));
|
||||
options.requires));
|
||||
else
|
||||
log.println(getMessage("inverse.transitive.dependencies.matching",
|
||||
options.regex != null
|
||||
? options.regex.toString()
|
||||
: "packages " + options.packageNames));
|
||||
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(" <- "))));
|
||||
analyzer.inverseDependences()
|
||||
.stream()
|
||||
.sorted(comparator())
|
||||
.map(this::toInversePath)
|
||||
.forEach(log::println);
|
||||
return ok;
|
||||
}
|
||||
|
||||
private String sortPath(Deque<Archive> path) {
|
||||
return path.peekFirst().getName();
|
||||
private String toInversePath(Deque<Archive> path) {
|
||||
return path.stream()
|
||||
.map(Archive::getName)
|
||||
.collect(joining(" <- "));
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a comparator for sorting the inversed path, grouped by
|
||||
* the first module name, then the shortest path and then sort by
|
||||
* the module names of each path
|
||||
*/
|
||||
private Comparator<Deque<Archive>> comparator() {
|
||||
return Comparator.<Deque<Archive>, String>
|
||||
comparing(deque -> deque.peekFirst().getName())
|
||||
.thenComparingInt(Deque::size)
|
||||
.thenComparing(this::toInversePath);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if --require is specified so that all modules are
|
||||
* analyzed to find all modules that depend on the modules specified in the
|
||||
* --require option directly and indirectly
|
||||
*/
|
||||
public boolean allModules() {
|
||||
return options.requires.size() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -924,6 +955,9 @@ class JdepsTask {
|
||||
return new ModuleAnalyzer(config, log, modules).run();
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true to analyze all modules
|
||||
*/
|
||||
public boolean allModules() {
|
||||
return true;
|
||||
}
|
||||
@ -957,6 +991,10 @@ class JdepsTask {
|
||||
option);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!inputArgs.isEmpty() && !options.rootModules.isEmpty()) {
|
||||
reportError("err.invalid.arg.for.option", "-m");
|
||||
}
|
||||
if (inputArgs.isEmpty() && !options.hasSourcePath()) {
|
||||
showHelp();
|
||||
return false;
|
||||
@ -971,11 +1009,6 @@ class JdepsTask {
|
||||
reduced,
|
||||
log).run();
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean allModules() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1155,7 +1188,7 @@ class JdepsTask {
|
||||
String systemModulePath = System.getProperty("java.home");
|
||||
String upgradeModulePath;
|
||||
String modulePath;
|
||||
String rootModule;
|
||||
Set<String> rootModules = new HashSet<>();
|
||||
Set<String> addmods = new HashSet<>();
|
||||
Runtime.Version multiRelease;
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.sun.tools.jdeps.Analyzer.NOT_FOUND;
|
||||
|
||||
@ -109,9 +110,7 @@ public class ModuleExportsAnalyzer extends DepsAnalyzer {
|
||||
private void printDependences() {
|
||||
// find use of JDK internals
|
||||
Map<Module, Set<String>> jdkinternals = new HashMap<>();
|
||||
deps.keySet().stream()
|
||||
.filter(source -> !source.getModule().isNamed())
|
||||
.map(deps::get)
|
||||
dependenceStream()
|
||||
.flatMap(map -> map.entrySet().stream())
|
||||
.filter(e -> e.getValue().size() > 0)
|
||||
.forEach(e -> jdkinternals.computeIfAbsent(e.getKey().getModule(),
|
||||
@ -124,11 +123,10 @@ public class ModuleExportsAnalyzer extends DepsAnalyzer {
|
||||
Module root = new RootModule("root");
|
||||
builder.addModule(root);
|
||||
// find named module dependences
|
||||
deps.keySet().stream()
|
||||
.filter(source -> !source.getModule().isNamed())
|
||||
.map(deps::get)
|
||||
dependenceStream()
|
||||
.flatMap(map -> map.keySet().stream())
|
||||
.filter(m -> m.getModule().isNamed())
|
||||
.filter(m -> m.getModule().isNamed()
|
||||
&& !configuration.rootModules().contains(m))
|
||||
.map(Archive::getModule)
|
||||
.forEach(m -> builder.addEdge(root, m));
|
||||
|
||||
@ -167,6 +165,16 @@ public class ModuleExportsAnalyzer extends DepsAnalyzer {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a stream of dependence map from an Archive to the set of JDK
|
||||
* internal APIs being used.
|
||||
*/
|
||||
private Stream<Map<Archive, Set<String>>> dependenceStream() {
|
||||
return deps.keySet().stream()
|
||||
.filter(source -> !source.getModule().isNamed()
|
||||
|| configuration.rootModules().contains(source))
|
||||
.map(deps::get);
|
||||
}
|
||||
|
||||
private class RootModule extends Module {
|
||||
final ModuleDescriptor descriptor;
|
||||
|
||||
@ -194,6 +194,7 @@ err.invalid.path=invalid path: {0}
|
||||
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.option.already.specified={0} option specified more than once.
|
||||
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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
###########################################################################
|
||||
#
|
||||
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,17 +36,14 @@ jdk/javadoc/doclet/testIOException/TestIOException.java
|
||||
#
|
||||
# jshell
|
||||
|
||||
jdk/jshell/EditorPadTest.java 8161276 windows-all Test set-up cannot press buttons
|
||||
jdk/jshell/ToolBasicTest.java 8139873 generic-all JShell tests failing
|
||||
jdk/jshell/ExternalEditorTest.java 8170108 generic-all
|
||||
jdk/jshell/ToolFormatTest.java 8170216 solaris-sparcv9
|
||||
jdk/jshell/ReplaceTest.java 8170216 solaris-sparcv9
|
||||
jdk/jshell/UserInputTest.java 8169536 generic-all
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# javac
|
||||
|
||||
tools/javac/Paths/AbsolutePathTest.java 8055768 generic-all ToolBox does not close opened files
|
||||
tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java 8057679 generic-all clarify error messages trying to annotate scoping
|
||||
tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.java 8057679 generic-all clarify error messages trying to annotate scoping
|
||||
tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java 8057679 generic-all clarify error messages trying to annotate scoping
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,6 +27,7 @@
|
||||
* @summary Verify that the user's code can read System.in
|
||||
* @build KullaTesting TestingInputStream
|
||||
* @run testng UserInputTest
|
||||
* @key intermittent
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -154,6 +154,11 @@ public class Main {
|
||||
errs += Integer.valueOf(m.group(2));
|
||||
if (m.group(3) != null)
|
||||
overflow++;
|
||||
} else if ((m = countPattern2.matcher(line)).matches()) {
|
||||
warns += Integer.valueOf(m.group(1));
|
||||
errs += Integer.valueOf(m.group(2));
|
||||
if (m.group(3) != null)
|
||||
overflow++;
|
||||
} else if ((m = guardPattern.matcher(line)).matches()) {
|
||||
boolean found = false;
|
||||
for (Pattern p: patterns) {
|
||||
@ -183,6 +188,7 @@ public class Main {
|
||||
|
||||
Pattern okPattern = Pattern.compile("No warnings or errors were found.");
|
||||
Pattern countPattern = Pattern.compile("([0-9]+) warnings, ([0-9]+) errors were found!.*?(Not all warnings/errors were shown.)?");
|
||||
Pattern countPattern2 = Pattern.compile("Tidy found ([0-9]+) warning[s]? and ([0-9]+) error[s]?!.*?(Not all warnings/errors were shown.)?");
|
||||
Pattern cssPattern = Pattern.compile("You are recommended to use CSS.*");
|
||||
Pattern guardPattern = Pattern.compile("line [0-9]+ column [0-9]+ - (Error|Warning):.*");
|
||||
|
||||
@ -221,7 +227,11 @@ public class Main {
|
||||
Pattern.compile(".*Warning: trimming empty <.*>"),
|
||||
Pattern.compile(".*Warning: unescaped & or unknown entity \".*\""),
|
||||
Pattern.compile(".*Warning: unescaped & which should be written as &"),
|
||||
Pattern.compile(".*Warning: using <br> in place of <p>")
|
||||
Pattern.compile(".*Warning: using <br> in place of <p>"),
|
||||
Pattern.compile(".*Warning: <.*> element removed from HTML5"),
|
||||
Pattern.compile(".*Warning: <.*> attribute \".*\" not allowed for HTML5"),
|
||||
Pattern.compile(".*Warning: The summary attribute on the <table> element is obsolete in HTML5"),
|
||||
Pattern.compile(".*Warning: replacing invalid UTF-8 bytes \\(char. code U\\+.*\\)")
|
||||
};
|
||||
|
||||
int files;
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 8144066
|
||||
* @summary GLB of two lower-bounded capture variables, bounded by related array types
|
||||
* @compile CaptureGLB1.java
|
||||
*/
|
||||
|
||||
public class CaptureGLB1 {
|
||||
|
||||
interface A<T> { }
|
||||
|
||||
Exception[] bar(A<? super Exception[]> x, A<? super Throwable[]> y){
|
||||
return foo(x, y);
|
||||
}
|
||||
|
||||
<T> T foo(A<? super T> x, A<? super T> y){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 8144066
|
||||
* @summary GLB of two lower-bounded capture variables, bounded by related wildcard-parameterized types
|
||||
* @compile CaptureGLB2.java
|
||||
*/
|
||||
|
||||
public class CaptureGLB2 {
|
||||
|
||||
interface A<T> { }
|
||||
|
||||
Class<?> bar(A<? super Class<? extends Exception>> x, A<? super Class<? extends Throwable>> y){
|
||||
return foo(x, y);
|
||||
}
|
||||
|
||||
<T> T foo(A<? super T> x, A<? super T> y){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8029718
|
||||
* @bug 8029718 8065800
|
||||
* @summary Should always use lambda body structure to disambiguate overload resolution
|
||||
* @compile/fail/ref=MostSpecific09.out -XDrawDiagnostics --should-stop:at=ATTR --debug:verboseResolution=applicable,success MostSpecific09.java
|
||||
*/
|
||||
|
||||
@ -2,7 +2,7 @@ MostSpecific09.java:25:9: compiler.note.verbose.resolve.multi: foo, MostSpecific
|
||||
MostSpecific09.java:26:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.I), null)}
|
||||
MostSpecific09.java:27:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.J), null)}
|
||||
MostSpecific09.java:27:32: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
|
||||
MostSpecific09.java:28:13: compiler.err.lambda.body.neither.value.nor.void.compatible
|
||||
MostSpecific09.java:28:20: compiler.err.lambda.body.neither.value.nor.void.compatible
|
||||
MostSpecific09.java:28:9: compiler.err.cant.apply.symbols: kindname.method, foo, @682,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
|
||||
MostSpecific09.java:28:43: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
|
||||
MostSpecific09.java:29:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(MostSpecific09.I), MostSpecific09, kindname.method, foo(MostSpecific09.J), MostSpecific09
|
||||
@ -10,7 +10,7 @@ MostSpecific09.java:29:28: compiler.note.verbose.resolve.multi: <init>, java.lan
|
||||
MostSpecific09.java:30:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(MostSpecific09.I), MostSpecific09, kindname.method, foo(MostSpecific09.J), MostSpecific09
|
||||
MostSpecific09.java:32:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(MostSpecific09.I), MostSpecific09, kindname.method, foo(MostSpecific09.J), MostSpecific09
|
||||
MostSpecific09.java:33:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.I), null)}
|
||||
MostSpecific09.java:42:13: compiler.err.lambda.body.neither.value.nor.void.compatible
|
||||
MostSpecific09.java:42:20: compiler.err.lambda.body.neither.value.nor.void.compatible
|
||||
MostSpecific09.java:42:9: compiler.err.cant.apply.symbols: kindname.method, foo, @1131,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
|
||||
MostSpecific09.java:46:23: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
|
||||
MostSpecific09.java:49:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.J), null)}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,9 +25,13 @@
|
||||
* @test
|
||||
* @bug 8034223
|
||||
* @summary Structural most-specific logic for lambdas, method refs, parens, and conditionals
|
||||
* @compile MostSpecific10.java
|
||||
*/
|
||||
class MostSpecific10 {
|
||||
|
||||
public class MostSpecific10 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific10().test(true);
|
||||
}
|
||||
|
||||
interface GetInt {
|
||||
int get();
|
||||
@ -38,7 +42,9 @@ class MostSpecific10 {
|
||||
}
|
||||
|
||||
void m(GetInt getter) {}
|
||||
void m(GetInteger getter) {}
|
||||
void m(GetInteger getter) {
|
||||
throw new AssertionError("Less-specific method invocation: " + getter.getClass());
|
||||
}
|
||||
|
||||
void test(boolean cond) {
|
||||
m(() -> 23);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,14 +25,19 @@
|
||||
* @test
|
||||
* @bug 8034223
|
||||
* @summary Return type Object is not more specific than return type String
|
||||
* @compile MostSpecific11.java
|
||||
*/
|
||||
class MostSpecific11 {
|
||||
public class MostSpecific11 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific11().test();
|
||||
}
|
||||
|
||||
interface I { Object run(); }
|
||||
interface J { String run(); }
|
||||
|
||||
void m(I arg) {}
|
||||
void m(I arg) {
|
||||
throw new RuntimeException("Less-specific method invocation.");
|
||||
}
|
||||
void m(J arg) {}
|
||||
|
||||
void test() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,18 @@
|
||||
* @test
|
||||
* @bug 8143852
|
||||
* @summary Rename functional interface method type parameters during most specific test
|
||||
* @compile MostSpecific15.java
|
||||
*/
|
||||
class MostSpecific15 {
|
||||
public class MostSpecific15 {
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific15().test();
|
||||
}
|
||||
|
||||
interface F1 { <X> Object apply(X arg); }
|
||||
interface F2 { <Y> String apply(Y arg); }
|
||||
|
||||
static void m1(F1 f) {}
|
||||
static void m1(F1 f) {
|
||||
throw new AssertionError("Less-specific method invocation.");
|
||||
}
|
||||
static void m1(F2 f) {}
|
||||
|
||||
static String foo(Object in) { return "a"; }
|
||||
@ -39,5 +44,4 @@ class MostSpecific15 {
|
||||
void test() {
|
||||
m1(MostSpecific15::foo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,9 +25,12 @@
|
||||
* @test
|
||||
* @bug 8143852
|
||||
* @summary Rename functional interface method type parameters during most specific test
|
||||
* @compile MostSpecific17.java
|
||||
*/
|
||||
class MostSpecific17 {
|
||||
public class MostSpecific17 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific17().test();
|
||||
}
|
||||
|
||||
interface A<T> {}
|
||||
interface B<T> extends A<T> {}
|
||||
@ -35,7 +38,9 @@ class MostSpecific17 {
|
||||
interface F1 { <X> A<? super X> apply(Object arg); }
|
||||
interface F2 { <Y> B<? super Y> apply(Object arg); }
|
||||
|
||||
static void m1(F1 f) {}
|
||||
static void m1(F1 f) {
|
||||
throw new AssertionError("Less-specific method invocation.");
|
||||
}
|
||||
static void m1(F2 f) {}
|
||||
|
||||
static B<Object> foo(Object in) { return null; }
|
||||
@ -43,5 +48,4 @@ class MostSpecific17 {
|
||||
void test() {
|
||||
m1(MostSpecific17::foo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,18 @@
|
||||
* @test
|
||||
* @bug 8143852
|
||||
* @summary Test that generic function interface method bounds are the same
|
||||
* @compile MostSpecific18.java
|
||||
*/
|
||||
class MostSpecific18 {
|
||||
public class MostSpecific18 {
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific18().test();
|
||||
}
|
||||
|
||||
interface F1 { <X extends Number> Object apply(X arg); }
|
||||
interface F2 { <Y extends Number> String apply(Y arg); }
|
||||
|
||||
static void m1(F1 f) {}
|
||||
static void m1(F1 f) {
|
||||
throw new AssertionError("Less-specific method invocation.");
|
||||
}
|
||||
static void m1(F2 f) {}
|
||||
|
||||
static String foo(Object in) { return "a"; }
|
||||
@ -39,5 +44,4 @@ class MostSpecific18 {
|
||||
void test() {
|
||||
m1(MostSpecific18::foo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,18 @@
|
||||
* @test
|
||||
* @bug 8143852
|
||||
* @summary Test that generic function interface method bounds are the same
|
||||
* @compile MostSpecific20.java
|
||||
*/
|
||||
class MostSpecific20 {
|
||||
public class MostSpecific20 {
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific20().test();
|
||||
}
|
||||
|
||||
interface F1 { <X extends Iterable<X>> Object apply(X arg); }
|
||||
interface F2 { <Y extends Iterable<Y>> String apply(Y arg); }
|
||||
|
||||
static void m1(F1 f) {}
|
||||
static void m1(F1 f) {
|
||||
throw new AssertionError("Less-specific method invocation.");
|
||||
}
|
||||
static void m1(F2 f) {}
|
||||
|
||||
static String foo(Object in) { return "a"; }
|
||||
@ -39,5 +44,4 @@ class MostSpecific20 {
|
||||
void test() {
|
||||
m1(MostSpecific20::foo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,19 @@
|
||||
* @test
|
||||
* @bug 8143852
|
||||
* @summary Most specific inference constraints derived from both functional interface method parameters and tparam bounds
|
||||
* @compile MostSpecific22.java
|
||||
*/
|
||||
class MostSpecific22 {
|
||||
|
||||
public class MostSpecific22 {
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific22().test();
|
||||
}
|
||||
|
||||
interface F1<T> { <X extends T> Object apply(T arg); }
|
||||
interface F2 { <Y extends Number> String apply(Number arg); }
|
||||
|
||||
static <T> T m1(F1<T> f) { return null; }
|
||||
static <T> T m1(F1<T> f) {
|
||||
throw new AssertionError("Less-specific method invocation.");
|
||||
}
|
||||
static Object m1(F2 f) { return null; }
|
||||
|
||||
static String foo(Object in) { return "a"; }
|
||||
@ -40,4 +46,4 @@ class MostSpecific22 {
|
||||
m1(MostSpecific22::foo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,18 @@
|
||||
* @test
|
||||
* @bug 8143852
|
||||
* @summary Most specific inference constraints derived from intersection bound
|
||||
* @compile MostSpecific27.java
|
||||
*/
|
||||
class MostSpecific27 {
|
||||
public class MostSpecific27 {
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific27().test();
|
||||
}
|
||||
|
||||
interface F1<T> { <X extends Iterable<T> & Runnable> Object apply(T arg); }
|
||||
interface F2 { <Y extends Iterable<Number> & Runnable> String apply(Number arg); }
|
||||
|
||||
static <T> T m1(F1<T> f) { return null; }
|
||||
static <T> T m1(F1<T> f) {
|
||||
throw new AssertionError("Less-specific method invocation.");
|
||||
}
|
||||
static Object m1(F2 f) { return null; }
|
||||
|
||||
static String foo(Object in) { return "a"; }
|
||||
@ -40,4 +45,4 @@ class MostSpecific27 {
|
||||
m1(MostSpecific27::foo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,15 +25,20 @@
|
||||
* @test
|
||||
* @bug 8144767
|
||||
* @summary Correct most-specific test when wildcards appear in functional interface type
|
||||
* @compile MostSpecific29.java
|
||||
*/
|
||||
class MostSpecific29 {
|
||||
public class MostSpecific29 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new MostSpecific29().test();
|
||||
}
|
||||
|
||||
interface Pred<T> { boolean test(T arg); }
|
||||
interface Fun<T,R> { R apply(T arg); }
|
||||
|
||||
static void m1(Pred<? super Integer> f) {}
|
||||
static void m1(Fun<Integer, Boolean> f) {}
|
||||
static void m1(Fun<Integer, Boolean> f) {
|
||||
throw new AssertionError("Less-specific method invocation.");
|
||||
}
|
||||
|
||||
void test() {
|
||||
m1((Integer n) -> true);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,7 +27,6 @@
|
||||
* @summary javac should issue the potentially ambiguous overload warning only
|
||||
* where the problem appears
|
||||
* @compile/fail/ref=PotentiallyAmbiguousWarningTest.out -XDrawDiagnostics -Werror -Xlint:overloads PotentiallyAmbiguousWarningTest.java
|
||||
* @compile PotentiallyAmbiguousWarningTest.java
|
||||
*/
|
||||
|
||||
import java.util.function.*;
|
||||
|
||||
@ -83,6 +83,28 @@ public class ListModuleDeps {
|
||||
));
|
||||
}
|
||||
|
||||
@DataProvider(name = "jdkModules")
|
||||
public Object[][] jdkModules() {
|
||||
return new Object[][]{
|
||||
{"jdk.compiler", new String[]{
|
||||
"java.base/sun.reflect.annotation",
|
||||
"java.compiler",
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "jdkModules")
|
||||
public void testJDKModule(String moduleName, String[] expected) {
|
||||
JdepsRunner jdeps = JdepsRunner.run(
|
||||
"--list-deps", "-m", moduleName
|
||||
);
|
||||
String[] output = Arrays.stream(jdeps.output())
|
||||
.map(s -> s.trim())
|
||||
.toArray(String[]::new);
|
||||
assertEquals(output, expected);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "listdeps")
|
||||
public void testListDeps(Path classes, String[] expected) {
|
||||
JdepsRunner jdeps = JdepsRunner.run(
|
||||
|
||||
@ -57,6 +57,7 @@ public class CheckModuleTest {
|
||||
private static final Set<String> modules = Set.of("unsafe", "mIV", "mV", "mVI", "mVII", "mVIII");
|
||||
|
||||
private static final String JAVA_BASE = "java.base";
|
||||
private static final String JAVA_COMPILER = "java.compiler";
|
||||
|
||||
/**
|
||||
* Compiles classes used by the test
|
||||
@ -73,6 +74,8 @@ public class CheckModuleTest {
|
||||
return new Object[][] {
|
||||
{ JAVA_BASE, new ModuleMetaData(JAVA_BASE)
|
||||
},
|
||||
{ JAVA_COMPILER, new ModuleMetaData(JAVA_BASE)
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -26,7 +26,9 @@
|
||||
* @summary Tests split packages
|
||||
* @library ../lib
|
||||
* @build CompilerUtils JdepsUtil
|
||||
* @modules jdk.jdeps/com.sun.tools.jdeps
|
||||
* @modules java.logging
|
||||
* jdk.jdeps/com.sun.tools.jdeps
|
||||
* jdk.unsupported
|
||||
* @run testng InverseDeps
|
||||
*/
|
||||
|
||||
@ -87,6 +89,44 @@ public class InverseDeps {
|
||||
}
|
||||
}
|
||||
}
|
||||
@DataProvider(name = "jdkModules")
|
||||
public Object[][] jdkModules() {
|
||||
return new Object[][]{
|
||||
// --require and a subset of dependences
|
||||
{ "jdk.compiler", new String[][] {
|
||||
new String[] {"jdk.compiler", "jdk.jshell"},
|
||||
new String[] {"jdk.compiler", "jdk.rmic"},
|
||||
new String[] {"jdk.compiler", "jdk.javadoc", "jdk.rmic"},
|
||||
}
|
||||
},
|
||||
{ "java.compiler", new String[][] {
|
||||
new String[] {"java.compiler", "jdk.jshell"},
|
||||
new String[] {"java.compiler", "jdk.compiler", "jdk.jshell"},
|
||||
new String[] {"java.compiler", "jdk.compiler", "jdk.rmic"},
|
||||
new String[] {"java.compiler", "jdk.compiler", "jdk.javadoc", "jdk.rmic"},
|
||||
new String[] {"java.compiler", "java.se", "java.se.ee"},
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "jdkModules")
|
||||
public void testJDKModule(String moduleName, String[][] expected) throws Exception {
|
||||
// this invokes the jdeps launcher so that all system modules are observable
|
||||
JdepsRunner jdeps = JdepsRunner.run(
|
||||
"--inverse", "--require", moduleName
|
||||
);
|
||||
List<String> output = Arrays.stream(jdeps.output())
|
||||
.map(s -> s.trim())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// verify the dependences
|
||||
assertTrue(Arrays.stream(expected)
|
||||
.map(path -> Arrays.stream(path)
|
||||
.collect(Collectors.joining(" <- ")))
|
||||
.anyMatch(output::contains));
|
||||
}
|
||||
|
||||
|
||||
@DataProvider(name = "testrequires")
|
||||
public Object[][] expected1() {
|
||||
|
||||
@ -63,10 +63,15 @@ public class SplitPackage {
|
||||
|
||||
@Test
|
||||
public void runTest() throws Exception {
|
||||
// Test jdeps classes
|
||||
runTest(null);
|
||||
// Test jdeps --add-modules
|
||||
// split package detected if java.annotation.common is in the root set
|
||||
runTest(JAVA_ANNOTATIONS_COMMON, SPLIT_PKG_NAME);
|
||||
runTest("ALL-SYSTEM", SPLIT_PKG_NAME);
|
||||
// default
|
||||
runTest(null, SPLIT_PKG_NAME);
|
||||
|
||||
// Test jdeps classes
|
||||
runTest("ALL-DEFAULT");
|
||||
|
||||
}
|
||||
|
||||
private void runTest(String root, String... splitPackages) throws Exception {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user