Currently, javac allows a user to specify a file manager to the JavaCompiler API.
The current behavior is that specifying some options, like -classpath, -source, etc, have an unspecified permanent side effect on the user provided file manager.
In addition, as noted inJDK-8139607, options like -release only work in conjunction with a StandardJavaFileManager.
A different approach would be for javac to "wrap" any user provided file manager with an instance-specific file manager, such that any changes resulting from javac options are confined to that instance, and not propagated to the user-provided file manager.
Thus, the behavior of methods in such a wrapper would be:
if this method is affected by local changes, impl the method locally; otherwise, delegate to the user provided file manager.
Note that (separately) the user file manager is already wrapped using ClientCodeWrapper, which exists to trap exceptions in a user provided file manager. The wrapping described here would be in addition to the use of ClientCodeWrapper.
The current behavior is that specifying some options, like -classpath, -source, etc, have an unspecified permanent side effect on the user provided file manager.
In addition, as noted in
A different approach would be for javac to "wrap" any user provided file manager with an instance-specific file manager, such that any changes resulting from javac options are confined to that instance, and not propagated to the user-provided file manager.
Thus, the behavior of methods in such a wrapper would be:
if this method is affected by local changes, impl the method locally; otherwise, delegate to the user provided file manager.
Note that (separately) the user file manager is already wrapped using ClientCodeWrapper, which exists to trap exceptions in a user provided file manager. The wrapping described here would be in addition to the use of ClientCodeWrapper.
- relates to
-
JDK-8139607 -release option forces StandardJavaFileManager
- Resolved
-
JDK-8150305 resolve FIXMEs in tools/javac/api/TestSearchPaths.java
- Open