< prev index next >
test/langtools/tools/javac/switchexpr/ExpressionSwitchToString.java
Print this page
rev 56806 : 8232684: Make switch expressions final
Reviewed-by: TBD
*** 97,107 ****
assert tool != null;
DiagnosticListener<JavaFileObject> noErrors = d -> {};
String sourceVersion = Integer.toString(Runtime.version().feature());
JavacTask ct = (JavacTask) tool.getTask(null, null, noErrors,
! List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null,
Arrays.asList(new MyFileObject(CODE)));
String actualCode = ct.parse().iterator().next().toString();
actualCode = actualCode.replace(System.getProperty("line.separator"), "\n");
if (!EXPECTED.equals(actualCode)) {
throw new AssertionError("Unexpected toString outcome: " +
--- 97,107 ----
assert tool != null;
DiagnosticListener<JavaFileObject> noErrors = d -> {};
String sourceVersion = Integer.toString(Runtime.version().feature());
JavacTask ct = (JavacTask) tool.getTask(null, null, noErrors,
! List.of("-XDdev"), null,
Arrays.asList(new MyFileObject(CODE)));
String actualCode = ct.parse().iterator().next().toString();
actualCode = actualCode.replace(System.getProperty("line.separator"), "\n");
if (!EXPECTED.equals(actualCode)) {
throw new AssertionError("Unexpected toString outcome: " +
< prev index next >