提交 6afc9482 编写于 作者: J jrose

7153157: ClassValue.get does not return if computeValue calls remove

Summary: Track intermediate states more precisely, according to spec.
Reviewed-by: twisti, forax
上级 2b078e87
...@@ -489,9 +489,18 @@ public abstract class ClassValue<T> { ...@@ -489,9 +489,18 @@ public abstract class ClassValue<T> {
/** Remove an entry. */ /** Remove an entry. */
synchronized synchronized
void removeEntry(ClassValue<?> classValue) { void removeEntry(ClassValue<?> classValue) {
// make all cache elements for this guy go stale: Entry<?> e = remove(classValue.identity);
if (remove(classValue.identity) != null) { if (e == null) {
// Uninitialized, and no pending calls to computeValue. No change.
} else if (e.isPromise()) {
// State is uninitialized, with a pending call to finishEntry.
// Since remove is a no-op in such a state, keep the promise
// by putting it back into the map.
put(classValue.identity, e);
} else {
// In an initialized state. Bump forward, and de-initialize.
classValue.bumpVersion(); classValue.bumpVersion();
// Make all cache elements for this guy go stale.
removeStaleEntries(classValue); removeStaleEntries(classValue);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册