JDK-8139474 : -release 7 -verbose causes Javac exception
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-10-13
  • Updated: 2016-03-16
  • Resolved: 2016-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b110Fixed
Related Reports
Relates :  
Description
I'm using:
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-jigsaw-nightly-h3477-20150929-b83)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-jigsaw-nightly-h3477-20150929-b83, mixed mode)

bar.java:
public class bar {}

javac -release 7 -verbose bar.java
[parsing started RegularFileObject[bar.java]]
[parsing completed 23ms]
[search path for source files: .]
[total 55ms]
An exception has occurred in the compiler (1.9.0-ea). Please file a bug at the Java Bug Database (http://bugreport.java.com/bugreport/) after checking the database for duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.IllegalStateException: java.lang.UnsupportedOperationException
        at com.sun.tools.javac.file.JavacFileManager$3.next(JavacFileManager.java:1052)
        at com.sun.tools.javac.file.JavacFileManager$3.next(JavacFileManager.java:1039)
        at com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:552)
        at com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:513)
        at com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:295)
        at com.sun.tools.javac.code.ClassFinder.access$000(ClassFinder.java:74)
        at com.sun.tools.javac.code.ClassFinder$1.complete(ClassFinder.java:166)
        at com.sun.tools.javac.code.Symbol.complete(Symbol.java:579)
        at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:299)
        at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:509)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:255)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:270)
        at com.sun.tools.javac.comp.Enter.complete(Enter.java:483)
        at com.sun.tools.javac.comp.Enter.main(Enter.java:467)
        at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:962)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:839)
        at com.sun.tools.javac.main.Main.compile(Main.java:254)
        at com.sun.tools.javac.main.Main.compile(Main.java:142)
        at com.sun.tools.javac.Main.compile(Main.java:56)
        at com.sun.tools.javac.Main.main(Main.java:42)
Caused by: java.lang.UnsupportedOperationException
        at jdk.nio.zipfs.ZipPath.toFile(ZipPath.java:582)
        at com.sun.tools.javac.file.JavacFileManager$3.next(JavacFileManager.java:1050)
        ... 19 more

Comments
Here are the imports for java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java.orig:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/OptionHelper.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java:import java.io.File; langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java:import java.io.File; We should audit the list. some may just be for File.separator or File.pathSeparator. Uses of java.io.File object (especially in conjunction with JavaFileManager) should be investigated.
10-02-2016

For bonus points, grep javac for "java.io.File" and see if there are any other remaining references that should be updated.
10-02-2016

Problem is these lines in javac ClassFinder: StandardJavaFileManager fm = (StandardJavaFileManager)fileManager; if (haveSourcePath && wantSourceFiles) { List<File> path = List.nil(); for (File file : fm.getLocation(SOURCE_PATH)) { path = path.prepend(file); } log.printVerbose("sourcepath", path.reverse().toString()); } else if (wantSourceFiles) { List<File> path = List.nil(); for (File file : fm.getLocation(CLASS_PATH)) { path = path.prepend(file); } log.printVerbose("sourcepath", path.reverse().toString()); } if (wantClassFiles) { List<File> path = List.nil(); for (File file : fm.getLocation(PLATFORM_CLASS_PATH)) { path = path.prepend(file); } for (File file : fm.getLocation(CLASS_PATH)) { path = path.prepend(file); } log.printVerbose("classpath", path.reverse().toString()); } Generally, all List<File> should become List<Path> (import java.nio.file.Path) and fm.getLocation should be changed to fm.getLocationAsPaths. Test program should be to use Toolbox to compile any file with -release 7 -verbose, and verify compilation is OK.
10-02-2016

Bug! It looks like there are remaining references to java.io.File, in the code for -verbose, which need to be converted to java.nio.file.Path
10-02-2016

This bug means users can't use the -release option in Oracle JDeveloper since -verbose is used as well to capture all Javac output so it can be filtered and used for displaying compiler progress to the user.
10-02-2016