diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/util/beans/BeanDescriptionFactory.java b/logback-core/src/main/java/ch/qos/logback/core/joran/util/beans/BeanDescriptionFactory.java index ccc7b66ceadd05db2c42a43f6f0eaf17e5f8354c..a6c730cce7398af6e13d246b1519f6567eb41630 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/joran/util/beans/BeanDescriptionFactory.java +++ b/logback-core/src/main/java/ch/qos/logback/core/joran/util/beans/BeanDescriptionFactory.java @@ -34,6 +34,10 @@ public class BeanDescriptionFactory extends ContextAwareBase { Map propertyNameToAdder = new HashMap(); Method[] methods = clazz.getMethods(); for (Method method : methods) { + if(method.isBridge()) { + // we can safely ignore bridge methods + continue; + } if (BeanUtil.isGetter(method)) { String propertyName = BeanUtil.getPropertyName(method); Method oldGetter = propertyNameToGetter.put(propertyName, method); @@ -55,8 +59,7 @@ public class BeanDescriptionFactory extends ContextAwareBase { String propertyName = BeanUtil.getPropertyName(method); Method oldAdder = propertyNameToAdder.put(propertyName, method); if (oldAdder != null) { - String message = String.format("Class '%s' contains multiple adders for the same property '%s'.", clazz.getCanonicalName(), - propertyName); + String message = String.format("Class '%s' contains multiple adders for the same property '%s'.", clazz.getCanonicalName(), propertyName); addWarn(message); } } diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/util/PropertySetterTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/util/PropertySetterTest.java index d328cb039b3e0cd71461073e387629229fa4d6df..8b523d0e645f99c683ab8a147e7db7ec1a7874e8 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/util/PropertySetterTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/util/PropertySetterTest.java @@ -33,25 +33,24 @@ import ch.qos.logback.core.joran.util.beans.BeanDescriptionCache; import ch.qos.logback.core.spi.FilterReply; import ch.qos.logback.core.status.StatusChecker; import ch.qos.logback.core.util.AggregationType; -import ch.qos.logback.core.util.StatusPrinter; public class PropertySetterTest { DefaultNestedComponentRegistry defaultComponentRegistry = new DefaultNestedComponentRegistry(); Context context = new ContextBase(); + StatusChecker checker = new StatusChecker(context); House house = new House(); - PropertySetter setter; // = new PropertySetter(new BeanDescriptionCache(context), basket); + PropertySetter setter = new PropertySetter(new BeanDescriptionCache(context), house); @Before public void setUp() { - //setter.setContext(context); + setter.setContext(context); } @After public void tearDown() { - StatusPrinter.print(context); } @Test @@ -230,8 +229,12 @@ public class PropertySetterTest { // see also http://jira.qos.ch/browse/LOGBACK-1164 @Test public void bridgeMethodsShouldBeIgnored() { - FruitBasket fruitBasket = new FruitBasket(); - PropertySetter fruitBasketSetter = new PropertySetter(new BeanDescriptionCache(context), fruitBasket); - fruitBasketSetter.computeAggregationType("orange"); + Orange orange = new Orange(); + + PropertySetter orangeSetter = new PropertySetter(new BeanDescriptionCache(context), orange); + assertEquals(AggregationType.AS_BASIC_PROPERTY, orangeSetter.computeAggregationType(Citrus.PRECARP_PROPERTY_NAME)); + + + checker.assertIsWarningOrErrorFree(); } }