Libraryless. Click here for Pure Java version (62L/1K).
1 | // TODO: JDK 17!! ?? No! Yes? Yes!! |
2 | |
3 | static O collectionMutex(L l) { |
4 | ret l; |
5 | } |
6 | |
7 | static O collectionMutex(O o) { |
8 | ifndef collectionMutex_simple |
9 | |
10 | if (o instanceof L) ret o; |
11 | |
12 | // TODO: actually use our own maps so we can get the mutex properly |
13 | |
14 | S c = className(o); |
15 | ifdef collectionMutex_legacy |
16 | if (eq(c, "java.util.TreeMap$KeySet")) |
17 | c = className(o = getOpt(o, 'm)); |
18 | else if (eq(c, "java.util.HashMap$KeySet")) |
19 | c = className(o = get_raw(o, 'this$0)); |
20 | |
21 | ifdef collectionMutex_debug |
22 | print("Class name: " + className(o)); |
23 | endifdef |
24 | |
25 | if (eqOneOf(c, "java.util.TreeMap$AscendingSubMap", "java.util.TreeMap$DescendingSubMap")) |
26 | c = className(o = get_raw(o, 'm)); |
27 | endifdef |
28 | |
29 | ifclass WeakHashSet |
30 | if (o instanceof WeakHashSet) |
31 | /*c = className*/(o = o/WeakHashSet.mutex()); |
32 | endif |
33 | |
34 | endifndef |
35 | ret o; |
36 | } |
Began life as a copy of #1013098
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jozkyjcghlvl, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1013619 |
Snippet name: | collectionMutex - get mutex field of KeySet etc. |
Eternal ID of this version: | #1013619/16 |
Text MD5: | bce2abdcf5382c10f8a2732841b84e90 |
Transpilation MD5: | 400418b39755edf36b469586a3be6f90 |
Author: | stefan |
Category: | javax / collections |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-20 01:32:21 |
Source code size: | 882 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 533 / 872 |
Version history: | 15 change(s) |
Referenced in: | [show references] |