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