method contract cache shouldn't depend on the annotation which might become invalid

This commit is contained in:
peter
2015-09-29 21:04:54 +02:00
parent cf233de737
commit bbc043dc72
@@ -1513,12 +1513,12 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
}
static List<MethodContract> getMethodContracts(@NotNull final PsiMethod method) {
final PsiAnnotation contractAnno = findContractAnnotation(method);
if (contractAnno != null) {
return CachedValuesManager.getCachedValue(contractAnno, new CachedValueProvider<List<MethodContract>>() {
@Nullable
@Override
public Result<List<MethodContract>> compute() {
return CachedValuesManager.getCachedValue(method, new CachedValueProvider<List<MethodContract>>() {
@Nullable
@Override
public Result<List<MethodContract>> compute() {
final PsiAnnotation contractAnno = findContractAnnotation(method);
if (contractAnno != null) {
String text = AnnotationUtil.getStringAttributeValue(contractAnno, null);
if (text != null) {
try {
@@ -1534,12 +1534,10 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
catch (Exception ignored) {
}
}
return Result.create(Collections.<MethodContract>emptyList(), contractAnno, method, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
});
}
return Collections.emptyList();
return Result.create(Collections.<MethodContract>emptyList(), method, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
});
}
@Nullable