8219254: Update explicit uses of latest source/target in langtools tests to a property

8219256: Update javac diags tests to use properties

Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Reviewed-by: jjg, jlahoda, darcy, iignatyev
This commit is contained in:
Joe Darcy 2019-02-21 10:29:16 -08:00
parent 86e513bd48
commit bf2d27c5a4
68 changed files with 183 additions and 131 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2019, 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
@ -88,14 +88,14 @@ import com.sun.source.util.TreePathScanner;
public class JavacParserTest extends TestCase {
static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
static final JavaFileManager fm = tool.getStandardFileManager(null, null, null);
public static final String SOURCE_VERSION =
Integer.toString(Runtime.version().feature());
private JavacParserTest(){}
public static void main(String... args) throws Exception {
try {
try (fm) {
new JavacParserTest().run(args);
} finally {
fm.close();
}
}
@ -1096,7 +1096,7 @@ public class JavacParserTest extends TestCase {
String expectedErrors = "Test.java:1:178: compiler.err.switch.case.unexpected.statement\n";
StringWriter out = new StringWriter();
JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", "13"),
Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", SOURCE_VERSION),
null, Arrays.asList(new MyFileObject(code)));
CompilationUnitTree cut = ct.parse().iterator().next();