Skip to content

Commit 67813ca

Browse files
committed
Fixed #1248
1 parent ebadfd2 commit 67813ca

File tree

8 files changed

+26
-5
lines changed

8 files changed

+26
-5
lines changed

release-notes/CREDITS

+4
Original file line numberDiff line numberDiff line change
@@ -450,3 +450,7 @@ Tom Mack (tommack@github)
450450
Nick Babcock (nickbabcock)
451451
* Reported #1225: `JsonMappingException` should override getProcessor()
452452
(2.7.5)
453+
454+
Andrew Joseph (apjoseph@github)
455+
* Reported #1248: `Annotated` returns raw type in place of Generic Type in 2.7.x
456+
(2.7.5)

release-notes/VERSION

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Project: jackson-databind
1212
(contributed by Eric S)
1313
#1231: `@JsonSerialize(as=superType)` behavior disallowed in 2.7.4
1414
(reported by Mark W)
15+
#1248: `Annotated` returns raw type in place of Generic Type in 2.7.x
16+
(reported by Andrew J, apjoseph@github)
1517

1618
2.7.4 (29-Apr-2016)
1719

src/main/java/com/fasterxml/jackson/databind/introspect/Annotated.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ public final JavaType getType(TypeBindings bogus) {
7171
}
7272

7373
/**
74-
* Full generic type of the annotated element; definition
75-
* of what exactly this means depends on sub-class.
74+
* JDK declared generic type of the annotated element; definition
75+
* of what exactly this means depends on sub-class. Note that such type
76+
* can not be reliably resolved without {@link TypeResolutionContext}, and
77+
* as a result use of this method was deprecated in Jackson 2.7: see
78+
* {@link #getType} for replacement.
7679
*
7780
* @deprecated Since 2.7 should instead use {@link #getType()}. To be removed from 2.8
7881
*/

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedClass.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public boolean hasAnnotation(Class<?> acls) {
257257
public boolean hasOneOf(Class<? extends Annotation>[] annoClasses) {
258258
return _classAnnotations().hasOneOf(annoClasses);
259259
}
260-
260+
261261
@Override
262262
public Class<?> getRawType() {
263263
return _class;

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedConstructor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public AnnotatedConstructor withAnnotations(AnnotationMap ann) {
7171
public JavaType getType() {
7272
return _typeContext.resolveType(getRawType());
7373
}
74-
74+
7575
@Override
7676
public Class<?> getRawType() {
7777
return _constructor.getDeclaringClass();

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedField.java

+6
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ public Class<?> getRawType() {
7575
return _field.getType();
7676
}
7777

78+
@Deprecated
79+
@Override
80+
public Type getGenericType() {
81+
return _field.getGenericType();
82+
}
83+
7884
@Override
7985
public JavaType getType() {
8086
return _typeContext.resolveType(_field.getGenericType());

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMethod.java

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ public JavaType getType() {
9090
return _typeContext.resolveType(_method.getGenericReturnType());
9191
}
9292

93+
@Deprecated
94+
@Override
95+
public Type getGenericType() {
96+
return _method.getGenericReturnType();
97+
}
98+
9399
/**
94100
* For methods, this returns declared return type, which is only
95101
* useful with getters (setters do not usually return anything;

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedParameter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public Class<?> getRawType() {
8888

8989
@Override
9090
public JavaType getType() {
91-
return _typeContext.resolveType(_type);
91+
return _type;
9292
}
9393

9494
/*

0 commit comments

Comments
 (0)