Skip to content

Cache ByteBuddy proxy classes for the class loader they are defined in - #1726

Merged
dashorst merged 3 commits into
masterfrom
WICKET-7204-regression-master
Oct 28, 2026
Merged

dashorst merged 3 commits into
masterfrom
WICKET-7204-regression-master

Conversation

@dashorst

Copy link
Copy Markdown
Contributor

Master counterpart of #1722, which fixes a regression of WICKET-7204 on 10.x. Master has the same ByteBuddyProxyFactory, and the same failure.

Since WICKET-7204 a ByteBuddy proxy class is defined with UsingLookup in the class loader of the proxied type, but the proxy class cache was still keyed on the application's class resolver, i.e. the context class loader of the current thread. A thread with another context class loader missed the cache and defined the proxy class a second time in the same loader, which fails with LinkageError: attempted duplicate class definition.

The cache is now keyed on the class loader the proxy is defined in. Types in a java.* package keep their own path: they are renamed, defined in a wrapper loader and cached for the application's loader, because java.sql and other platform types have a loader that cannot see Wicket's interfaces.

The commits are Andrea's two from #1722 plus a cleanup on top, cherry-picked unchanged. Squash on merge.

Generated-by: Claude Code (Claude Opus 5.5)

Andrea Del Bene and others added 3 commits October 28, 2026 10:44
…proxies

A non-java.* type on the bootstrap class loader cannot get a private
lookup, so its proxy fails on that regardless of the class loader it is
cached for; the fallback to the application's class loader for it is
gone. isInternalJavaType becomes isInJavaPackage, because java.sql and
java.net.http are not internal. The rationale on resolveClassLoader(Class)
moves to the commit message, and a test proxies java.sql.Timestamp, whose
platform class loader is the reason the java.* check in
resolveClassLoader(Class) has to stay.

Generated-by: Claude Code (Claude Opus 5.5)
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.17%. Comparing base (d7fc021) to head (f3c46aa).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1726   +/-   ##
=========================================
  Coverage     63.17%   63.17%           
- Complexity    11556    11557    +1     
=========================================
  Files          1253     1253           
  Lines         48631    48635    +4     
  Branches       6844     6844           
=========================================
+ Hits          30721    30725    +4     
+ Misses        15193    15192    -1     
- Partials       2717     2718    +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dashorst
dashorst merged commit a7a4a40 into master Oct 28, 2026
3 checks passed
@dashorst
dashorst deleted the WICKET-7204-regression-master branch October 28, 2026 11:35
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.

3 participants