// TODO: JDK 17!! ?? No! Yes? Yes!! static O collectionMutex(L l) { ret l; } static O collectionMutex(O o) { ifndef collectionMutex_simple if (o instanceof L) ret o; // TODO: actually use our own maps so we can get the mutex properly S c = className(o); ifdef collectionMutex_legacy if (eq(c, "java.util.TreeMap$KeySet")) c = className(o = getOpt(o, 'm)); else if (eq(c, "java.util.HashMap$KeySet")) c = className(o = get_raw(o, 'this$0)); ifdef collectionMutex_debug print("Class name: " + className(o)); endifdef if (eqOneOf(c, "java.util.TreeMap$AscendingSubMap", "java.util.TreeMap$DescendingSubMap")) c = className(o = get_raw(o, 'm)); endifdef ifclass WeakHashSet if (o instanceof WeakHashSet) /*c = className*/(o = o/WeakHashSet.mutex()); endif endifndef ret o; }