From c6e28c3af76d0f7ec1168669d9c1653bedb6a4ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Sun, 27 Jan 2019 21:35:53 +0100 Subject: [PATCH] Skip bridge-methods for POJO-getter/setter #314 Bridge-methods are generated by the compiler. In case of #314, getter and setter are created because the class inherited from a parametr. class and the getter/setter work on Object (as in the parent-class, after type erasure). That's why they need to be excluded from the list of methods to choose getters and setters from. --- core/src/main/java/org/sql2o/reflection/PojoMetadata.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/sql2o/reflection/PojoMetadata.java b/core/src/main/java/org/sql2o/reflection/PojoMetadata.java index f67c6b88..34b0b0f8 100644 --- a/core/src/main/java/org/sql2o/reflection/PojoMetadata.java +++ b/core/src/main/java/org/sql2o/reflection/PojoMetadata.java @@ -115,7 +115,9 @@ private PropertyAndFieldInfo initializePropertyInfo() { // prepare methods. Methods will override fields, if both exists. for (Method m : theClass.getDeclaredMethods()) { - + if(m.isBridge()) { + continue; + } if (m.getName().startsWith("get")) { String propertyName = m.getName().substring(3); if (caseSensitive) {