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

Re-examine Package of the same name allowed from ClassLoader.getPackages

    XMLWordPrintable

Details

    • Bug
    • Resolution: Other
    • P4
    • 9
    • None
    • core-libs
    • None

    Description

      Some issues with the current implementations were brought up during review of 8060130:
      http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-October/029085.html

      Currently there's no possibility of preventing name collisions of packages defined in different classloaders, e.g., a Package can be defined in an ancestral classloader at any time (or in a child classloader as the result of a race), while ClassLoader.getPackages effectively hides packages defined in ancestral classloaders when there are name collisions with packages defined in the current classloader.

      The most straightforward solution seems to be to return all distinct packages, regardless of name uniqueness, as suggested by Mandy Chung (http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-October/029146.html).

      It would also seem that the restriction on package definition in child classloaders should be loosened so that we only check the locally defined packages in ClassLoader.definePackage.

      Attachments

        Issue Links

          Activity

            People

              mchung Mandy Chung
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: