[MAGNOLIA-5865] @TransformedBy on setters can cause the transformer to be used for all instances of the type Created: 04/Aug/14 Updated: 03/Feb/17 Resolved: 03/Feb/17 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Magnolia International | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | cleanup, devwl, improvement, n2b | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| 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
|
||||||||
| Date of First Response: | |||||||||
| Story Points: | 5 | ||||||||
| Description |
|
When doing the following:
class FooBar {
@TransformedBy(MyTransformer.class)
void setBaz(Command c) {}
}
One would expect that MyTransformer is only used when setting the Command instance on FooBar's Baz property. However, the unit test committed with this ticket id reveals that it is set globally, for all instances of Command ... in tur, this also means that setter-based transformers are only taken into account if the setter in question is the first where Node2Bean encounters the type in question (it's otherwise using a cached TypeDescriptor) |
| Comments |
| Comment by Magnolia International [ 04/Aug/14 ] |
|
I discovered this while implementing |
| Comment by Magnolia International [ 05/Aug/14 ] |
|
Since transformers are currently only specified in TypeDescriptor, I'm not sure we have a straightforward fix that wouldn't involve severe changes in Node2Bean. I'm not sure we want to deprecate/remove the feature or actually try to fix this at this stage. |
| Comment by Magnolia International [ 05/Aug/14 ] |
|
Added a log/warn for 5.3.2, let's see what we can do for 5.4 |
| Comment by Michael Mühlebach [ 03/Feb/17 ] |
|
It seems that nobody is running into this problem aka not using transformedBy annotation. In case this becomes an issue please reopen with additional details. |