RFR: 8280035: Use Class.isInstance instead of Class.isAssignableFrom where applicable [v2]
Daniel Fuchs
dfuchs at openjdk.java.net
Tue May 10 11:43:55 UTC 2022
On Tue, 10 May 2022 11:31:16 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java line 230:
>>
>>> 228: List<SubRegistry> l = new ArrayList<>();
>>> 229: for (Class<?> c : categoryMap.keySet()) {
>>> 230: if (c.isInstance(provider)) {
>>
>> Can this be reached if `provider` is null? If yes there could be a change of behaviour as the previous code would have thrown NPE.
>
> No. This method is called from 3 places, and there 3 null checks before the method call.
Thanks for double checking! LGTM then.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7061
More information about the serviceability-dev
mailing list