diff -r aceae9ceebbe -r c2d9303c3477 test/tools/javac/api/6437999/T6437999.java --- a/test/tools/javac/api/6437999/T6437999.java Tue Jun 25 20:08:52 2013 +0400 +++ b/test/tools/javac/api/6437999/T6437999.java Wed Jun 26 09:54:46 2013 -0700 @@ -33,11 +33,28 @@ */ import java.io.File; +import java.io.IOException; import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; import javax.tools.*; +import static java.nio.file.StandardOpenOption.*; public class T6437999 extends ToolTester { + final File testFile = new File("Utf8.java"); + T6437999() throws IOException { + createTestFile(); + } + final void createTestFile() throws IOException { + List scratch = new ArrayList<>(); + scratch.add("// @author Peter von der Ah" + (char) 0xe9); + scratch.add("class Utf8{}"); + Files.write(testFile.toPath(), scratch, Charset.forName("UTF-8"), + CREATE, TRUNCATE_EXISTING); + } + static class MyDiagnosticListener implements DiagnosticListener { boolean error = false; public void report(Diagnostic diagnostic) { @@ -55,7 +72,7 @@ dl.error = false; fm = getFileManager(tool, dl, Charset.forName("ASCII")); fm.handleOption("-source", sourceLevel.iterator()); - files = fm.getJavaFileObjects(new File(test_src, "Utf8.java")); + files = fm.getJavaFileObjects(testFile); tool.getTask(null, fm, null, null, null, files).call(); if (!dl.error) throw new AssertionError("No error in ASCII mode"); @@ -63,12 +80,12 @@ dl.error = false; fm = getFileManager(tool, dl, Charset.forName("UTF-8")); fm.handleOption("-source", sourceLevel.iterator()); - files = fm.getJavaFileObjects(new File(test_src, "Utf8.java")); + files = fm.getJavaFileObjects(testFile); task = tool.getTask(null, fm, null, null, null, files); if (dl.error) throw new AssertionError("Error in UTF-8 mode"); } - public static void main(String... args) { + public static void main(String... args) throws IOException { new T6437999().test(args); } }