Skip to content

Commit

Permalink
Fixed #2758
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 24, 2020
1 parent 7e3aa6f commit 1473b03
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
14 changes: 8 additions & 6 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -1115,17 +1115,19 @@ Michael Cramer (BigMichi1@github)
fails randomly
(2.11.1)

Oleg Chtchoukine (oshatrk@github)
* Reported #2759: Rearranging of props when property-based generator is in use leads
to incorrect output
Frank Schmager (fschmager@github)
* Reported #2757: "Conflicting setter definitions for property" exception for `Map`
subtype during deserialization
(2.11.1)

Johannes Kuhn (DasBrain@github)
* Reported #2758: Fail to deserialize local Records
(2.11.1)
* Reported #2760: Jackson doesn't respect `CAN_OVERRIDE_ACCESS_MODIFIERS=false` for
deserializer properties
(2.11.1)
Frank Schmager (fschmager@github)
* Reported #2757: "Conflicting setter definitions for property" exception for `Map`
subtype during deserialization
Oleg Chtchoukine (oshatrk@github)
* Reported #2759: Rearranging of props when property-based generator is in use leads
to incorrect output
(2.11.1)
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Project: jackson-databind
#2757: "Conflicting setter definitions for property" exception for `Map`
subtype during deserialization
(reported by Frank S)
#2758: Fail to deserialize local Records
(reported by Johannes K)
#2759: Rearranging of props when property-based generator is in use leads
to incorrect output
(reported by Oleg C)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,8 @@ protected boolean isPotentialBeanType(Class<?> type)
if (ClassUtil.isProxyType(type)) {
throw new IllegalArgumentException("Cannot deserialize Proxy class "+type.getName()+" as a Bean");
}
/* also: can't deserialize some local classes: static are ok; in-method not;
* other non-static inner classes are ok
*/
// also: can't deserialize some local classes: static are ok; in-method not;
// other non-static inner classes are ok
typeStr = ClassUtil.isLocalType(type, true);
if (typeStr != null) {
throw new IllegalArgumentException("Cannot deserialize Class "+type.getName()+" (of type "+typeStr+") as a Bean");
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,23 @@ public static String isLocalType(Class<?> type, boolean allowNonStatic)
{
/* As per [JACKSON-187], GAE seems to throw SecurityExceptions
* here and there... and GAE itself has a bug, too
* (see []). Bah. So we need to catch some wayward exceptions on GAE
* Bah. So we need to catch some wayward exceptions on GAE
*/
try {
final boolean isStatic = Modifier.isStatic(type.getModifiers());

// one more: method locals, anonymous, are not good:
if (hasEnclosingMethod(type)) {
// 23-Jun-2020, tatu: [databind#2758] With JDK14+ should allow
// local Record types, however
if (!isStatic && hasEnclosingMethod(type)) {
return "local/anonymous";
}
/* But how about non-static inner classes? Can't construct
* easily (theoretically, we could try to check if parent
* happens to be enclosing... but that gets convoluted)
*/
if (!allowNonStatic) {
if (isNonStaticInnerClass(type)) {
if (!isStatic && getEnclosingClass(type) != null) {
return "non-static member class";
}
}
Expand Down

0 comments on commit 1473b03

Please sign in to comment.