[MAGNOLIA-7893] ByteBuddyMutableWrapperHelper does not cache the generated proxy classes Created: 30/Sep/20  Updated: 26/Aug/21  Resolved: 06/Oct/20

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 6.2.3
Fix Version/s: 6.2.4

Type: Bug Priority: Neutral
Reporter: Aleksandr Pchelintcev Assignee: Aleksandr Pchelintcev
Resolution: Fixed Votes: 0
Labels: maintenance
Remaining Estimate: Not Specified
Time Spent: 8m
Original Estimate: Not Specified

Issue Links:
Relates
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Release notes required:
Yes
Sprint: Maintenance 27

 Description   

Unlike other cases of ByteBuddy library usage (e.g. ByteBuddyI18nIzer) ByteBuddyMutableWrapperHelper) doesn't use TypeCache to prevent the mutators from being generated for the same classes over and over.

Actually resulting proxy anyway use the getter/setter delegate (invoker) that accepts the wrapped instance. Effectively the wrapper classes can be cached already.

The only issue out there is that ByteBuddy builder configures delegation to a concrete interceptor that takes a concrete instance-bound invoker, which "bakes" in the connection to a concrete instance from the generated proxy. The solution to this problem is very simple: do not pass the invoker explicitly to the DefaultInterceptor's constructor, rather inject it as an argument into intercept method via _INVOKER field, which we anyway set.


Generated at Mon Feb 12 04:27:47 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.