On Wed, 28 Apr 2021 17:25:46 GMT, Joe Wang <[email protected]> wrote:
>> src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java
>> line 264:
>>
>>> 262: int temp;
>>> 263: if (Integer.class.isAssignableFrom(value.getClass())) {
>>> 264: temp = (Integer)value;
>>
>> Why not use pattern matching?
>> `if (value instanceof Integer intValue) {
>> temp = intValue;
>> }
>
> Good question. Given that the earlier changes in the whole set (impl-specific
> properties) were backported, I assumed this would too, to be complete. Code
> consistency and clean backport may exceed the benefit of a more advanced code
> feature (e.g. pattern matching).
>
> I also am still doing works based on JDK 8, that provides a much quicker
> turnaround.
>
> Saw Patrick's pattern matching changesets for some lib code. It's possible we
> could do it as well for the xml code. But in general, xml code, esp. those
> from Apache support a lower source level.
ok, JDK 8 could use instanceof instead of isAssignable.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3644