8196618: Create API to list supported values for javac --release option

8194308: jdeprscan will need updates to deal with the removal of the Java EE modules

Generalizing tests to run over all supported --release keys; fixing jdeprscan to work with --release 11.

Reviewed-by: smarks, vromero
This commit is contained in:
Jan Lahoda 2018-06-14 13:16:21 +02:00
parent 83aae3288e
commit 5bf8a6f44b
8 changed files with 133 additions and 32 deletions

View file

@ -28,7 +28,9 @@
* @library /tools/lib
* @modules
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.jvm
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.platform
* jdk.jdeps/com.sun.tools.classfile
* @build toolbox.ToolBox toolbox.JavacTask
* @run main JavaBaseTest
@ -37,10 +39,12 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.StreamSupport;
import com.sun.tools.classfile.Attribute;
import com.sun.tools.classfile.Attributes;
@ -48,9 +52,11 @@ import com.sun.tools.classfile.ClassFile;
import com.sun.tools.classfile.ClassWriter;
import com.sun.tools.classfile.Module_attribute;
import com.sun.tools.javac.jvm.Target;
import com.sun.tools.javac.platform.JDKPlatformProvider;
import toolbox.JavacTask;
import toolbox.Task;
import toolbox.Task.Expect;
import toolbox.ToolBox;
public class JavaBaseTest {
@ -66,8 +72,6 @@ public class JavaBaseTest {
List.of("static", "transitive")
);
final List<String> targets = List.of("9", "10", "current");
enum Mode { SOURCE, CLASS };
ToolBox tb = new ToolBox();
@ -75,6 +79,14 @@ public class JavaBaseTest {
int errorCount = 0;
void run() throws Exception {
Set<String> targets = new LinkedHashSet<>();
StreamSupport.stream(new JDKPlatformProvider().getSupportedPlatformNames()
.spliterator(),
false)
.filter(p -> Integer.parseInt(p) >= 9)
.forEach(targets::add);
//run without --release:
targets.add("current");
for (List<String> mods : modifiers) {
for (String target : targets) {
for (Mode mode : Mode.values()) {