Skip to content

refactor: stop renaming proxy fields when hashing - #424

Merged
algomaster99 merged 1 commit into
mainfrom
refactor/drop-proxy-field-renaming
Nov 11, 2026
Merged

algomaster99 merged 1 commit into
mainfrom
refactor/drop-proxy-field-renaming

Conversation

@algomaster99

@algomaster99 algomaster99 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Related to #384.

Summary

HashComputer renamed the Method fields of every proxy class after the instructions in <clinit> that initialize them, and sorted those blocks of <clinit>. This made a proxy's checksum stable across JVM runs, which mattered while proxies were recorded in the BOMI.

Since #396 that is no longer the case:

  • The indexers do not record proxies.
  • The watchdog verifies a proxy by regenerating it with the running JDK under the same name and comparing the two checksums in the same JVM.

Within one JVM the JDK numbers the fields of a proxy identically, so the renaming never changes a verdict. This PR removes it.

Evidence

I generated the proxy of java.beans.BeanProperty twice per JVM, in separate JVM runs:

JDK Different bytes across runs Different bytes within one run
11.0.22 yes (3 orders in 18 runs) never
17.0.10 yes, with -Xshare:off never
21.0.6 yes, when other names were interned first never
25.0.2 yes, with -Xshare:off or other names interned first never

The non-determinism across runs is real, but only within-run comparisons remain.

Since #396 the watchdog verifies a proxy by regenerating it with the
running JDK under the same name and comparing both hashes in the same
JVM, and the indexers no longer record proxies. Within one JVM the JDK
numbers the Method fields of a proxy identically, so renaming them after
their initializer and sorting the initializer blocks never changes a
verdict.

Only hashes of classes that extend java.lang.reflect.Proxy change. No
BOMI contains such hashes, so existing BOMIs stay valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@algomaster99
algomaster99 merged commit 697616f into main Nov 11, 2026
9 checks passed
@algomaster99
algomaster99 deleted the refactor/drop-proxy-field-renaming branch November 11, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant