Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8266596

StandardJavaFileManager: default impls of setLocationFromPaths(), getJavaFileObjectsFromPaths() methods don't throw IllegalArgumentException as specified

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b28
    • Verification:
      Verified

      Backports

        Description

        The following specifications
        https://docs.oracle.com/en/java/javase/16/docs/api/java.compiler/javax/tools/StandardJavaFileManager.html#getJavaFileObjectsFromPaths(java.lang.Iterable)
        https://docs.oracle.com/en/java/javase/16/docs/api/java.compiler/javax/tools/StandardJavaFileManager.html#getJavaFileObjectsFromPaths(java.util.Collection)
        https://docs.oracle.com/en/java/javase/16/docs/api/java.compiler/javax/tools/StandardJavaFileManager.html#setLocationFromPaths(javax.tools.JavaFileManager.Location,java.util.Collection)
        say:

        =================================
        Implementation Requirements:
            IllegalArgumentException will be thrown if any of the paths cannot be converted to a file.
        =================================

        Actually OpenJDK implementation performs a lazy conversion of the given paths to files
        and IllegalArgumentException won't be thrown if some of the passed paths in not convertable to file
        until and if the 'receiver' methods (setLocation() or getJavaFileObjectsFromFiles()) perform the actual iteration over Iterable<? extends File>.

        Moreover if some implementation of getJavaFileObjectsFromFiles() creates another lazy Iterable<? extends JavaFileObject> then IAE would be thrown only when the user tries to iterate over the result.

        Either the spec needs to be corrected to match the impl or implemenation(s) should be made non-lazy


          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jlahoda Jan Lahoda
                Reporter:
                dbessono Dmitry Bessonov
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: