This commit is contained in:
2024-07-07 11:53:40 +02:00
parent 3cbd229597
commit 990deb7df8
2 changed files with 11 additions and 7 deletions

View File

@@ -149,9 +149,11 @@ public class JObject<T extends JObjectData> implements Serializable, Comparable<
assertRWLock();
if (_dataPart.get() != null)
throw new IllegalStateException("Data is not null when recording external resolution of " + getName());
if (!data.pushResolution())
throw new IllegalStateException("Expected external resolution only for classes with pushResolution " + getName());
_metaPart.narrowClass(data.getClass());
_dataPart.set(data);
if (!_metaPart.isLocked() && _metaPart.getRefcount() == 0)
if (!_metaPart.isLocked())
_metaPart.lock();
hydrateRefs();
verifyRefs();

View File

@@ -145,16 +145,18 @@ public class JObjectManagerImpl implements JObjectManager {
}
JObject<D> finalRet = (JObject<D>) ret;
ret.runWriteLocked(JObject.ResolutionStrategy.NO_RESOLUTION, (m, d, b, i) -> {
if (parent.isPresent()) {
m.addRef(parent.get());
} else {
m.lock();
}
if (object.pushResolution() && object.assumeUnique() && finalRet.getData() == null) {
finalRet.externalResolution(object);
}
if (parent.isPresent()) {
m.addRef(parent.get());
if (m.isLocked())
m.unlock();
} else {
m.lock();
}
return true;
});
return (JObject<D>) ret;