8321182: SourceExample.SOURCE_14 comment should refer to 'switch expressions' instead of 'text blocks'
Reviewed-by: darcy
This commit is contained in:
parent
3a09a052bc
commit
2f299e4a73
@ -42,9 +42,7 @@ import javax.tools.JavaFileObject;
|
|||||||
import javax.tools.StandardJavaFileManager;
|
import javax.tools.StandardJavaFileManager;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -240,16 +238,8 @@ public class Versions {
|
|||||||
|
|
||||||
protected void check(String major, List<String> args) {
|
protected void check(String major, List<String> args) {
|
||||||
printargs("check", args);
|
printargs("check", args);
|
||||||
List<String> jcargs = new ArrayList<>();
|
|
||||||
jcargs.add("-Xlint:-options");
|
|
||||||
|
|
||||||
// add in args conforming to List requrements of JavaCompiler
|
List<String> jcargs = javaCompilerOptions(args);
|
||||||
for (String onearg : args) {
|
|
||||||
String[] fields = onearg.split(" ");
|
|
||||||
for (String onefield : fields) {
|
|
||||||
jcargs.add(onefield);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean creturn = compile("Base.java", jcargs);
|
boolean creturn = compile("Base.java", jcargs);
|
||||||
if (!creturn) {
|
if (!creturn) {
|
||||||
@ -264,6 +254,25 @@ public class Versions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a list of options suitable for use with {@link JavaCompiler}
|
||||||
|
* @param args a list of space-delimited options, such as "-source 11"
|
||||||
|
* @return a list of arguments suitable for use with {@link JavaCompiler}
|
||||||
|
*/
|
||||||
|
private static List<String> javaCompilerOptions(List<String> args) {
|
||||||
|
List<String> jcargs = new ArrayList<>();
|
||||||
|
jcargs.add("-Xlint:-options");
|
||||||
|
|
||||||
|
// add in args conforming to List requirements of JavaCompiler
|
||||||
|
for (String onearg : args) {
|
||||||
|
String[] fields = onearg.split(" ");
|
||||||
|
for (String onefield : fields) {
|
||||||
|
jcargs.add(onefield);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return jcargs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The BASE source example is expected to compile on all source
|
* The BASE source example is expected to compile on all source
|
||||||
* levels. Otherwise, an example is expected to compile on its
|
* levels. Otherwise, an example is expected to compile on its
|
||||||
@ -311,7 +320,7 @@ public class Versions {
|
|||||||
"""),
|
"""),
|
||||||
|
|
||||||
SOURCE_14(14, "New14.java",
|
SOURCE_14(14, "New14.java",
|
||||||
// New feature in 14: text blocks
|
// New feature in 14: switch expressions
|
||||||
"""
|
"""
|
||||||
public class New14 {
|
public class New14 {
|
||||||
static {
|
static {
|
||||||
@ -427,16 +436,7 @@ public class Versions {
|
|||||||
protected void pass(List<String> args) {
|
protected void pass(List<String> args) {
|
||||||
printargs("pass", args);
|
printargs("pass", args);
|
||||||
|
|
||||||
List<String> jcargs = new ArrayList<>();
|
List<String> jcargs = javaCompilerOptions(args);
|
||||||
jcargs.add("-Xlint:-options");
|
|
||||||
|
|
||||||
// add in args conforming to List requrements of JavaCompiler
|
|
||||||
for (String onearg : args) {
|
|
||||||
String[] fields = onearg.split(" ");
|
|
||||||
for (String onefield : fields) {
|
|
||||||
jcargs.add(onefield);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// empty list is error
|
// empty list is error
|
||||||
if (jcargs.isEmpty()) {
|
if (jcargs.isEmpty()) {
|
||||||
@ -464,16 +464,7 @@ public class Versions {
|
|||||||
protected void fail(List<String> args) {
|
protected void fail(List<String> args) {
|
||||||
printargs("fail", args);
|
printargs("fail", args);
|
||||||
|
|
||||||
List<String> jcargs = new ArrayList<>();
|
List<String> jcargs = javaCompilerOptions(args);
|
||||||
jcargs.add("-Xlint:-options");
|
|
||||||
|
|
||||||
// add in args conforming to List requrements of JavaCompiler
|
|
||||||
for (String onearg : args) {
|
|
||||||
String[] fields = onearg.split(" ");
|
|
||||||
for (String onefield : fields) {
|
|
||||||
jcargs.add(onefield);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// empty list is error
|
// empty list is error
|
||||||
if (jcargs.isEmpty()) {
|
if (jcargs.isEmpty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user