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.
|Release Note: Restrict javax.imageio.spi.ServiceRegistry to ImageIO types||Closed||Unassigned||