Test for lost annotations
diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java b/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java
index 4c4bbd5..13a1be2 100644
--- a/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java
+++ b/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java
@@ -1056,7 +1056,7 @@
* Node used for creating simple linked lists to efficiently store small sets
* of things.
*/
- private final static class Linked<T>
+ protected final static class Linked<T>
{
public final T value;
public final Linked<T> next;
diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestPOJOPropertiesCollector.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestPOJOPropertiesCollector.java
index 8b59a9b..cf961c9 100644
--- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestPOJOPropertiesCollector.java
+++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestPOJOPropertiesCollector.java
@@ -1,5 +1,9 @@
package com.fasterxml.jackson.databind.introspect;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
import java.math.BigDecimal;
import java.util.*;
@@ -198,7 +202,35 @@
@JsonProperty(required=true, index=B_INDEX, defaultValue="13")
public int getB() { return b; }
}
-
+
+ @Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+ @Retention(RetentionPolicy.RUNTIME)
+ @JacksonAnnotation
+ @interface A {}
+
+ @Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+ @Retention(RetentionPolicy.RUNTIME)
+ @JacksonAnnotation
+ @interface B {}
+
+ static class DuplicateGetterBean
+ {
+ @A
+ public boolean isBloop() { return true; }
+
+ @B
+ public boolean getBloop() { return true; }
+ }
+
+ static class DuplicateGetterCreatorBean
+ {
+ public DuplicateGetterCreatorBean(@JsonProperty("bloop") @A boolean bloop) {}
+
+ public boolean isBloop() { return true; }
+
+ public boolean getBloop() { return true; }
+ }
+
/*
/**********************************************************
/* Unit tests
@@ -433,6 +465,30 @@
_verifyProperty(beanDesc, false, true, "13");
}
+ public void testDuplicateGetters() throws Exception
+ {
+ POJOPropertiesCollector coll = collector(MAPPER, DuplicateGetterBean.class, true);
+ List<BeanPropertyDefinition> props = coll.getProperties();
+ assertEquals(1, props.size());
+ BeanPropertyDefinition prop = props.get(0);
+ assertEquals("bloop", prop.getName());
+ assertTrue(prop.getGetter().hasAnnotation(A.class));
+ assertTrue(prop.getGetter().hasAnnotation(B.class));
+ }
+
+ public void testDuplicateGettersCreator() throws Exception
+ {
+ POJOPropertiesCollector coll = collector(MAPPER, DuplicateGetterCreatorBean.class, true);
+ List<BeanPropertyDefinition> props = coll.getProperties();
+ assertEquals(1, props.size());
+ POJOPropertyBuilder prop = (POJOPropertyBuilder) props.get(0);
+ assertEquals("bloop", prop.getName());
+ // Can't call getGetter or the duplicate will be removed
+ assertTrue(prop._getters.value.hasAnnotation(A.class));
+ assertNotNull(prop._getters.next);
+ assertTrue(prop._getters.next.value.hasAnnotation(A.class));
+ }
+
private void _verifyProperty(BeanDescription beanDesc,
boolean verifyDesc, boolean verifyIndex, String expDefaultValue)
{