static Map convertObjectMetaToMap(IMeta o, IF0 createEmptyMap default () -> new LinkedHashMap) { if (o == null) null; // The following shortcut depends on the assumption that a meta field never reverts // to null when it was a map O meta = o._getMeta(); if (meta cast Map) ret meta; // non-shortcut path (create meta) temp var mutex = tempMetaMutex(o); var actualMutex = mutex!; synchronized(actualMutex) { O meta = o._getMeta(); if (meta cast Map) ret meta; Map map = createEmptyMap!; if (meta != null) map.put(previousMeta := meta); o._setMeta(map); ret map; } }