Commit 5a59ff6
Fix trySetAccessible() caching bug causing Field inaccessibility
WeakHashMap uses equals()-based lookup, but Field.equals() matches by
declaring class + name + type, not identity. When getDeclaredFields()
was called with different predicates, the JVM returned different Field
instances for the same logical field. The cache returned TRUE for the
second instance (via equals match), but setAccessible(true) was never
called on it, leaving it inaccessible. This caused Traverser to silently
skip inaccessible fields, breaking GraphComparator.applyDelta().
Fix: only cache FALSE (failures) to avoid expensive repeated exceptions.
setAccessible(true) on an already-accessible field is a cheap no-op.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 9e33b6e commit 5a59ff6
1 file changed
Lines changed: 9 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2785 | 2785 | | |
2786 | 2786 | | |
2787 | 2787 | | |
2788 | | - | |
2789 | | - | |
2790 | | - | |
2791 | | - | |
2792 | | - | |
2793 | | - | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
2794 | 2796 | | |
2795 | 2797 | | |
2796 | | - | |
2797 | | - | |
2798 | | - | |
2799 | | - | |
2800 | | - | |
2801 | | - | |
| 2798 | + | |
2802 | 2799 | | |
2803 | 2800 | | |
2804 | | - | |
2805 | 2801 | | |
2806 | 2802 | | |
2807 | 2803 | | |
| |||
0 commit comments