RFR: 8357185: Redundant local variables with unconditionally matching primitive patterns [v3]

Chen Liang liach at openjdk.org
Mon Jul 7 17:37:35 UTC 2025


> A commit in the implementation of JEP 455, https://github.com/openjdk/jdk/pull/15638/commits/ceee1e4c08457a0793fdfb556db99e057a947af1, added redundant synthetic local variable for trivial `instanceof int`-ish type conversion operations in the javac AST. Such conversions have been present since the introduction of record patterns, and previously they consistently lower to the part before `instanceof`. With this change, the introduced redundant variable is visible in the class file, as seen in the JBS issue.
> 
> Testing: langtools/tools/javac

Chen Liang has updated the pull request incrementally with one additional commit since the last revision:

  Review remarks, test adjustment

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26107/files
  - new: https://git.openjdk.org/jdk/pull/26107/files/544822b0..2507bf23

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26107&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26107&range=01-02

  Stats: 190 lines in 3 files changed: 83 ins; 100 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/26107.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26107/head:pull/26107

PR: https://git.openjdk.org/jdk/pull/26107


More information about the compiler-dev mailing list