Repository navigation
Commit 8a65c7c
fix: avoid NPE in trustedLookup on environments without IMPL_LOOKUP, for issue #4011
On Android, the static initializer leaves IMPL_LOOKUP null because the
Unsafe-based access to MethodHandles.Lookup.IMPL_LOOKUP is gated to
!ANDROID. trustedLookup(Class) then NPE'd at IMPL_LOOKUP.in(...),
producing the user-visible "Attempt to invoke virtual method
MethodHandles$Lookup.in(...) on a null object reference" when parsing
Kotlin data classes via JSON.parseObject on Android 16 (API 36).
- JDKUtils.trustedLookup: short-circuit and return null when IMPL_LOOKUP
is unavailable. Most existing callers already wrap usage in try/catch
and fall back to reflection-based access, so a null Lookup is the
cleanest signal.
- ObjectReaderCreator.lambdaSetter / createBuildFunctionLambda: handle
the null Lookup explicitly and return null so callers fall back to
reflection instead of throwing JSONException("create fieldReader error").1 parent 3697c2d commit 8a65c7c
2 files changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2186 | 2186 | | |
2187 | 2187 | | |
2188 | 2188 | | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
2189 | 2192 | | |
2190 | 2193 | | |
2191 | 2194 | | |
| |||
3994 | 3997 | | |
3995 | 3998 | | |
3996 | 3999 | | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
| 4005 | + | |
3997 | 4006 | | |
3998 | 4007 | | |
3999 | 4008 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
473 | 482 | | |
474 | 483 | | |
475 | 484 | | |
| |||
0 commit comments