Field based JavaXProperty creates unnecessary objects

Description

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.

Environment

None

Activity

Show:

Emmanuel BernardJuly 27, 2017 at 9:22 AM

Applied, thank you. And no excuse for the massive delay

Fixed

Details

Assignee

Reporter

Participants

Andrej Golovnin
Emmanuel Bernard

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
Loading...