File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
src/main/java/com/fasterxml/jackson/databind/util Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ Project: jackson-databind
19
19
#5151: Add new exception type, `MissingInjectValueException`, to be used
20
20
for failed `@JacksonInject`
21
21
#5179: Add "current token" info into `MismatchedInputException`
22
+ #5192: Record types are broken on Android when using R8
23
+ (reported by @HelloOO7)
24
+ (fix by @pjfanning)
22
25
- Generate SBOMs [JSTEP-14]
23
26
24
27
2.19.1 (13-Jun-2025)
Original file line number Diff line number Diff line change @@ -24,6 +24,19 @@ public final class ClassUtil
24
24
25
25
private final static Iterator <Object > EMPTY_ITERATOR = Collections .emptyIterator ();
26
26
27
+ // 16-Jun-2025: [databind#5195]: we will dynamically access `Class.isRecord()`
28
+ // added in JDK 16, earlier versions do not have it; will eval as `null`.
29
+ private final static Method IS_RECORD ;
30
+ static {
31
+ Method m = null ;
32
+ try {
33
+ m = Class .class .getMethod ("isRecord" );
34
+ } catch (NoSuchMethodException e ) {
35
+ // no-op, will be null
36
+ }
37
+ IS_RECORD = m ;
38
+ }
39
+
27
40
/*
28
41
/**********************************************************
29
42
/* Simple factory methods
@@ -299,8 +312,19 @@ public static boolean isBogusClass(Class<?> cls) {
299
312
* @since 2.12
300
313
*/
301
314
public static boolean isRecordType (Class <?> cls ) {
302
- Class <?> parent = cls .getSuperclass ();
303
- return (parent != null ) && "java.lang.Record" .equals (parent .getName ());
315
+ // 16-Jun-2025: [databind#5195]: implementation changed from 2.19
316
+ // where we checked if `cls.getParent() == "java.lang.Record" which
317
+ // caused issues on Android, desugared cases. This is a more reliable
318
+ // method for checking.
319
+ if (IS_RECORD == null ) {
320
+ return false ;
321
+ }
322
+ try {
323
+ return (Boolean ) IS_RECORD .invoke (cls );
324
+ } catch (Exception e ) {
325
+ // hopefully, this is not going to happen
326
+ return false ;
327
+ }
304
328
}
305
329
306
330
/**
You can’t perform that action at this time.
0 commit comments