langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java Tue Oct 21 09:01:51 2014 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java Tue Oct 21 13:08:20 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -25,15 +25,18 @@
package com.sun.tools.javac.file;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharsetDecoder;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@@ -49,8 +52,6 @@
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.List;
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
/**
* <p><b>This is NOT part of any supported API.
@@ -131,10 +132,10 @@
return "ZipArchive[" + zfile.getName() + "]";
}
- private File getAbsoluteFile() {
- File absFile = (absFileRef == null ? null : absFileRef.get());
+ private Path getAbsoluteFile() {
+ Path absFile = (absFileRef == null ? null : absFileRef.get());
if (absFile == null) {
- absFile = new File(zfile.getName()).getAbsoluteFile();
+ absFile = Paths.get(zfile.getName()).toAbsolutePath();
absFileRef = new SoftReference<>(absFile);
}
return absFile;
@@ -155,7 +156,7 @@
/**
* A reference to the absolute filename for the zip file for the archive.
*/
- protected Reference<File> absFileRef;
+ protected Reference<Path> absFileRef;
/**
* A subclass of JavaFileObject representing zip entries.
@@ -175,7 +176,7 @@
@DefinedBy(Api.COMPILER)
public URI toUri() {
- File zipFile = new File(zarch.zfile.getName());
+ Path zipFile = Paths.get(zarch.zfile.getName());
return createJarUri(zipFile, entry.getName());
}
@@ -186,7 +187,7 @@
@Override
public String getShortName() {
- return new File(zarch.zfile.getName()).getName() + "(" + entry + ")";
+ return Paths.get(zarch.zfile.getName()).getFileName() + "(" + entry + ")";
}
@Override @DefinedBy(Api.COMPILER)
@@ -246,7 +247,7 @@
}
@Override
- protected String inferBinaryName(Iterable<? extends File> path) {
+ protected String inferBinaryName(Iterable<? extends Path> path) {
String entryName = entry.getName();
return removeExtension(entryName).replace('/', '.');
}