play-json
play-json copied to clipboard
fix JsonMemoryFootprintSpec with JDK 21
Pull Request Checklist
- [x] Have you read through the contributor guidelines?
- [x] Have you squashed your commits?
- [x] Have you added copyright headers to new files?
- [x] Have you updated the documentation?
- [x] Have you added tests for any changed functionality?
Fixes
Purpose
pending some test if JDK 21 because fail.
Background Context
https://github.com/openjdk/jdk/commit/17ce0976e442d5fabb14daed40fa9a768989f02e#diff-cdf6d0587f1021c14e1af0d9cab581de2809cd1dbcf8bd87f5a5a304dc087263R333
add int putMode
since JDK 21.
inspect java.util.LinkedHashMap
by jol
JDK 17
java.util.LinkedHashMap object internals:
OFFSET SIZE TYPE DESCRIPTION VALUE
0 4 (object header) 01 00 00 00 (00000001 00000000 00000000 00000000) (1)
4 4 (object header) 00 00 00 00 (00000000 00000000 00000000 00000000) (0)
8 4 (object header) d8 65 11 00 (11011000 01100101 00010001 00000000) (1140184)
12 4 Set AbstractMap.keySet (access denied)
16 4 Collection AbstractMap.values (access denied)
20 4 int HashMap.size (access denied)
24 4 int HashMap.modCount (access denied)
28 4 int HashMap.threshold (access denied)
32 4 float HashMap.loadFactor (access denied)
36 4 Node[] HashMap.table (access denied)
40 4 Set HashMap.entrySet (access denied)
44 1 boolean LinkedHashMap.accessOrder (access denied)
45 3 (alignment/padding gap) N/A
48 4 Entry LinkedHashMap.head (access denied)
52 4 Entry LinkedHashMap.tail (access denied)
Instance size: 56 bytes
Space losses: 3 bytes internal + 0 bytes external = 3 bytes total
JDK 21
java.util.LinkedHashMap object internals:
OFFSET SIZE TYPE DESCRIPTION VALUE
0 4 (object header) 01 00 00 00 (00000001 00000000 00000000 00000000) (1)
4 4 (object header) 00 00 00 00 (00000000 00000000 00000000 00000000) (0)
8 4 (object header) b8 d7 0f 00 (10111000 11010111 00001111 00000000) (1038264)
12 4 Set AbstractMap.keySet (access denied)
16 4 Collection AbstractMap.values (access denied)
20 4 int HashMap.size (access denied)
24 4 int HashMap.modCount (access denied)
28 4 int HashMap.threshold (access denied)
32 4 float HashMap.loadFactor (access denied)
36 4 Node[] HashMap.table (access denied)
40 4 Set HashMap.entrySet (access denied)
44 4 int LinkedHashMap.putMode (access denied)
48 1 boolean LinkedHashMap.accessOrder (access denied)
49 3 (alignment/padding gap) N/A
52 4 Entry LinkedHashMap.head (access denied)
56 4 Entry LinkedHashMap.tail (access denied)
60 4 (loss due to the next object alignment)
Instance size: 64 bytes
Space losses: 3 bytes internal + 4 bytes external = 7 bytes total
References
Instead of making the tests pending on JDK21, how about testing against the actual values? See
- #968
Thanks again, however I merged
- #968
instead which makes a bit more sense in this case IMHO.