mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
recreate cached value with the new provider when it's outdated, to be more tolerant to providers capturing variables from the call context
This commit is contained in:
@@ -59,7 +59,7 @@ public class CachedValuesManagerImpl extends CachedValuesManager {
|
||||
if (dataHolder instanceof UserDataHolderEx) {
|
||||
UserDataHolderEx dh = (UserDataHolderEx)dataHolder;
|
||||
value = dh.getUserData(key);
|
||||
if (value instanceof CachedValueBase && !((CachedValueBase)value).isFromMyProject(myProject)) {
|
||||
if (isOutdated(value)) {
|
||||
value = null;
|
||||
dh.putUserData(key, null);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class CachedValuesManagerImpl extends CachedValuesManager {
|
||||
else {
|
||||
synchronized (dataHolder) {
|
||||
value = dataHolder.getUserData(key);
|
||||
if (value instanceof CachedValueBase && !((CachedValueBase)value).isFromMyProject(myProject)) {
|
||||
if (isOutdated(value)) {
|
||||
value = null;
|
||||
}
|
||||
if (value == null) {
|
||||
@@ -84,6 +84,11 @@ public class CachedValuesManagerImpl extends CachedValuesManager {
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
private boolean isOutdated(CachedValue<?> value) {
|
||||
return value instanceof CachedValueBase &&
|
||||
(!((CachedValueBase)value).isFromMyProject(myProject) || !value.hasUpToDateValue());
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user