RFR: 8286269: [java.desktop] Use newer instanceof language feature wherever possible

SWinxy duke at openjdk.java.net
Fri May 6 04:00:23 UTC 2022


The old java.desktop package needs dusting off. It hasn't been kept up to pace with the Java language, but it should. The purpose of this PR is to replace most or all `instanceof` checks with the new `instanceof` with a variable. Some methods that used `instanceof` were also reworked alongside the change (such as `.equals()`) if they were small and they could be clearer.
There should be no actual change in outcomes from this PR. I have triple checked my work. Some cases are kinda 'wut?'.
This is also a large change. When pattern matching for switch arrives, many methods can be reworked to take advantage of it (when it comes.. eventually ;w;).

-------------

Commit messages:
 - Merge branch 'master' into instanceof
 - Use new instanceof in platform-specific classes
 - Use instanceof language feature wherever possible

Changes: https://git.openjdk.java.net/jdk/pull/7000/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7000&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8286269
  Stats: 4652 lines in 368 files changed: 474 ins; 1329 del; 2849 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7000.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7000/head:pull/7000

PR: https://git.openjdk.java.net/jdk/pull/7000



More information about the client-libs-dev mailing list