RFR: 8280035: Use Class.isInstance instead of Class.isAssignableFrom where applicable [v2]
Andrey Turbanov
aturbanov at openjdk.java.net
Tue May 10 11:35:04 UTC 2022
On Tue, 10 May 2022 11:10:50 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8280035: Use Class.isInstance instead of Class.isAssignableFrom where applicable
>> apply suggestion to avoid second Method.invoke call
>
> 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.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7061
More information about the hotspot-jfr-dev
mailing list