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

Restrict javax.imageio.spi.ServiceRegistry to ImageIO types

    XMLWordPrintable

    Details

      Backports

        Description


        The lookupProviders methods in javax.imageio.spi.ServiceRegistry are wrappers around ServiceLoader.load. This is problematic for modules because the ServiceLoader.load method look at their caller to check if the caller is in a module and if so, that the caller's module has the right "uses" in its module declaration. For now, then calling lookupProviders will cause ServiceLoader to check that ServiceRegistry's module (java.desktop) declares the "uses" and this will probably fail because the java.desktop module is unlikely to have it.

        One approach to addressing this is to change these methods to be @CallerSensitive, pick-up the caller, and create a ServiceLoader in a manner that makes it look like the caller of ServiceRegistry.lookupProviders is the caller.

        The alternative is to do nothing and just deprecate these methods. This option may not be too bad if we can establish that these methods are rarely, if ever, used outside of the JDK.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                smarks Stuart Marks
                Reporter:
                alanb Alan Bateman
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                  Dates

                  Due:
                  Created:
                  Updated:
                  Resolved: