Field based JavaXProperty creates unnecessary objects
Description
Environment
None
is followed up by
Activity
Show:
Emmanuel BernardJuly 27, 2017 at 9:22 AM
Applied, thank you. And no excuse for the massive delay
Fixed
Details
Assignee
Andrej GolovninAndrej GolovninReporter
Andrej GolovninAndrej GolovninParticipants
Andrej Golovnin
Emmanuel BernardPull Request
Fix versions
Priority
Major
Details
Details
Assignee

Reporter

Participants

Pull Request
Fix versions
Priority
Created December 16, 2015 at 8:18 PM
Updated March 14, 2024 at 9:48 PM
Resolved February 13, 2018 at 12:19 PM
Current implementation of the Reflection API does not use the same caching as used for auto-boxing. This has been fixed in JDK 9 (see https://bugs.openjdk.java.net/browse/JDK-5043030 for details) but not in JDK 8 or 7. Therefore, when JavaXProperty reads for example a primitive field of the type "boolean", it creates every time a new object of type "Boolean". We can workaround this problem by using getter-methods of the Field class, which return primitive values, and wrapping the result using the valueOf-methods of the wrapper classes.