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

spec clarification for URLClassLoader for Multirelease jars

    XMLWordPrintable

Details

    • b155
    • Not verified

    Backports

      Description

        As per current spec ,

        This class loader supports the loading of classes from the contents of a multi-release JAR file that is referred to by a given URL.

        However even loading of a versioned resource(text file etc.) is supported by URLClassLoader.

        For E.g.:

        mr.jar has following structure:

        META-INF/MANIFEST.MF
        iterator1.txt
        META-INF/
        META-INF/versions/
        META-INF/versions/9/
        META-INF/versions/9/iterator1.txt
        META-INF/versions/10/
        META-INF/versions/10/iterator1.txt

          URL url = Paths.get("D:\\JEP-238\\mr.jar").toUri().toURL();
                URLClassLoader urlClassLoader = new URLClassLoader(new URL[]{url});
                System.out.println(urlClassLoader.findResource("iterator1.txt"));
                
                OUTPUT : jar:file:/D:/JEP-238/mr.jar!/META-INF/versions/9/iterator1.txt

        Hence the spec should mention it.

        It could be:
        "This class loader supports the loading of classes and resources from the contents of a multi-release JAR file that is referred to by a given URL."

        Attachments

          Issue Links

            Activity

              People

                psandoz Paul Sandoz
                bnallakaluva Bharath Nallakaluva (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: