-
Bug
-
Resolution: Fixed
-
P2
-
17
-
b28
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8269193 | 18 | Jan Lahoda | P2 | Resolved | Fixed | b03 |
JDK-8270614 | 17.0.1 | Jan Lahoda | P2 | Resolved | Fixed | b03 |
The following specification
https://docs.oracle.com/en/java/javase/16/docs/api/java.compiler/javax/tools/StandardJavaFileManager.html#getJavaFileObjects(java.nio.file.Path...)
asserts:
=================================
NullPointerException - if the given array contains null elements
=================================
However for OpenJDK implementation the following code produces no NPEs
========================
var stJFM = new StandardJavaFileManager() {
@Override public int isSupportedOption(String option) { return 0; }
@Override public ClassLoader getClassLoader(Location location) { return null; }
@Override public Iterable<JavaFileObject> list(Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException { return null; }
@Override public String inferBinaryName(Location location, JavaFileObject file) { return null; }
@Override public boolean isSameFile(FileObject a, FileObject b) { return false; }
@Override public boolean handleOption(String current, Iterator<String> remaining) { return false; }
@Override public boolean hasLocation(Location location) { return false; }
@Override public JavaFileObject getJavaFileForInput(Location location, String className, JavaFileObject.Kind kind) throws IOException { return null; }
@Override public JavaFileObject getJavaFileForOutput(Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException { return null; }
@Override public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { return null; }
@Override public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException { return null; }
@Override public void flush() throws IOException { }
@Override public void close() throws IOException { }
@Override public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) { return null; }
@Override public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) { return null; }
@Override public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) { return null; }
@Override public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) { return null; }
@Override public void setLocation(Location location, Iterable<? extends File> files) throws IOException { }
@Override public Iterable<? extends File> getLocation(Location location) { return null; }
};
stJFM.getJavaFileObjects((Path)null);
stJFM.getJavaFileObjects((Path)null, (Path)null);
stJFM.getJavaFileObjects(Path.of("a"), (Path)null);
========================
While the following call would generate an NPE:
stJFM.getJavaFileObjects((Path[])null);
https://docs.oracle.com/en/java/javase/16/docs/api/java.compiler/javax/tools/StandardJavaFileManager.html#getJavaFileObjects(java.nio.file.Path...)
asserts:
=================================
NullPointerException - if the given array contains null elements
=================================
However for OpenJDK implementation the following code produces no NPEs
========================
var stJFM = new StandardJavaFileManager() {
@Override public int isSupportedOption(String option) { return 0; }
@Override public ClassLoader getClassLoader(Location location) { return null; }
@Override public Iterable<JavaFileObject> list(Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException { return null; }
@Override public String inferBinaryName(Location location, JavaFileObject file) { return null; }
@Override public boolean isSameFile(FileObject a, FileObject b) { return false; }
@Override public boolean handleOption(String current, Iterator<String> remaining) { return false; }
@Override public boolean hasLocation(Location location) { return false; }
@Override public JavaFileObject getJavaFileForInput(Location location, String className, JavaFileObject.Kind kind) throws IOException { return null; }
@Override public JavaFileObject getJavaFileForOutput(Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException { return null; }
@Override public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { return null; }
@Override public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException { return null; }
@Override public void flush() throws IOException { }
@Override public void close() throws IOException { }
@Override public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) { return null; }
@Override public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) { return null; }
@Override public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) { return null; }
@Override public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) { return null; }
@Override public void setLocation(Location location, Iterable<? extends File> files) throws IOException { }
@Override public Iterable<? extends File> getLocation(Location location) { return null; }
};
stJFM.getJavaFileObjects((Path)null);
stJFM.getJavaFileObjects((Path)null, (Path)null);
stJFM.getJavaFileObjects(Path.of("a"), (Path)null);
========================
While the following call would generate an NPE:
stJFM.getJavaFileObjects((Path[])null);
- backported by
-
JDK-8269193 StandardJavaFileManager: getJavaFileObjects() impl violates the spec
- Resolved
-
JDK-8270614 StandardJavaFileManager: getJavaFileObjects() impl violates the spec
- Resolved
- clones
-
JDK-8266596 StandardJavaFileManager: default impls of setLocationFromPaths(), getJavaFileObjectsFromPaths() methods don't throw IllegalArgumentException as specified
- Closed
- csr for
-
JDK-8268260 StandardJavaFileManager: getJavaFileObjects() impl violates the spec
- Closed
(2 links to)