--- a/langtools/test/tools/javac/6508981/TestInferBinaryName.java Mon Dec 07 09:18:07 2015 -0800
+++ b/langtools/test/tools/javac/6508981/TestInferBinaryName.java Mon Dec 07 14:02:55 2015 -0800
@@ -53,9 +53,6 @@
* the impl of inferBinaryName for that file object.
*/
public class TestInferBinaryName {
- static final boolean DONT_USE_ZIP_FILE_INDEX = false;
- static final boolean USE_ZIP_FILE_INDEX = true;
-
public static void main(String... args) throws Exception {
new TestInferBinaryName().run();
}
@@ -64,10 +61,7 @@
testDirectory();
File testJar = createJar();
-
testZipArchive(testJar);
- testZipFileIndexArchive(testJar);
- testZipFileIndexArchive2(testJar);
if (errors > 0)
throw new Exception(errors + " error found");
@@ -87,40 +81,18 @@
void testDirectory() throws IOException {
String testClassName = "p.A";
List<File> testClasses = Arrays.asList(new File(System.getProperty("test.classes")));
- try (JavaFileManager fm =
- getFileManager(testClasses, USE_ZIP_FILE_INDEX)) {
+ try (JavaFileManager fm = getFileManager(testClasses)) {
test("testDirectory",
- fm, testClassName, "com.sun.tools.javac.file.RegularFileObject");
+ fm, testClassName, "SimpleFileObject");
}
}
void testZipArchive(File testJar) throws IOException {
String testClassName = "java.lang.String";
List<File> path = Arrays.asList(testJar);
- try (JavaFileManager fm =
- getFileManager(path, DONT_USE_ZIP_FILE_INDEX)) {
+ try (JavaFileManager fm = getFileManager(path)) {
test("testZipArchive",
- fm, testClassName, "com.sun.tools.javac.file.ZipArchive$ZipFileObject");
- }
- }
-
- void testZipFileIndexArchive(File testJar) throws IOException {
- String testClassName = "java.lang.String";
- List<File> path = Arrays.asList(testJar);
- try (JavaFileManager fm =
- getFileManager(path, USE_ZIP_FILE_INDEX)) {
- test("testZipFileIndexArchive",
- fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
- }
- }
-
- void testZipFileIndexArchive2(File testJar) throws IOException {
- String testClassName = "java.lang.String";
- List<File> path = Arrays.asList(testJar);
- try (JavaFileManager fm =
- getFileManager(path, USE_ZIP_FILE_INDEX)) {
- test("testZipFileIndexArchive2",
- fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
+ fm, testClassName, "JarFileObject");
}
}
@@ -141,21 +113,17 @@
return;
}
- String cn = fo.getClass().getName();
+ String cn = fo.getClass().getSimpleName();
String bn = fm.inferBinaryName(CLASS_PATH, fo);
System.err.println(testName + " " + cn + " " + bn);
- check(cn, implClassName);
- check(bn, testClassName);
+ checkEqual(cn, implClassName);
+ checkEqual(bn, testClassName);
System.err.println("OK");
}
- JavaFileManager getFileManager(List<File> path,
- boolean zipFileIndexKind)
+ JavaFileManager getFileManager(List<File> path)
throws IOException {
Context ctx = new Context();
- Options options = Options.instance(ctx);
- options.put("useOptimizedZip",
- Boolean.toString(zipFileIndexKind == USE_ZIP_FILE_INDEX));
JavacFileManager fm = new JavacFileManager(ctx, false, null);
fm.setLocation(CLASS_PATH, path);
@@ -163,7 +131,7 @@
}
List<File> getPath(String s) {
- List<File> path = new ArrayList<File>();
+ List<File> path = new ArrayList<>();
for (String f: s.split(File.pathSeparator)) {
if (f.length() > 0)
path.add(new File(f));
@@ -172,7 +140,7 @@
return path;
}
- void check(String found, String expect) {
+ void checkEqual(String found, String expect) {
if (!found.equals(expect)) {
System.err.println("Expected: " + expect);
System.err.println(" Found: " + found);