Commit c1923b56 authored by alexey.afanasiev's avatar alexey.afanasiev
Browse files

IDEA-174905 False positive inspection warning on Spring Data repository "save"...

IDEA-174905 False positive inspection warning on Spring Data repository "save" method. Fixing tests. IDEA-CR-26237
parent fa618c74
Showing with 17 additions and 5 deletions
+17 -5
......@@ -65,6 +65,15 @@ public abstract class GroovyResolverProcessor implements PsiScopeProcessor, Elem
return new SubstitutorComputer(myThisType, myArgumentTypesNonErased.getValue(), myTypeArguments, myRef, myRef.getParent());
}
};
private final NotNullLazyValue<SubstitutorComputer> myMethodErasedSubstitutorComputer = new NotNullLazyValue<SubstitutorComputer>() {
@NotNull
@Override
protected SubstitutorComputer compute() {
return new SubstitutorComputer(myThisType, myArgumentTypes.getValue(), myTypeArguments, myRef, myRef.getParent());
}
};
private final List<PsiScopeProcessor> myAccessorProcessors;
protected final MultiMap<GroovyResolveKind, GroovyResolveResult> myCandidates = MultiMap.create();
......@@ -159,14 +168,16 @@ public abstract class GroovyResolverProcessor implements PsiScopeProcessor, Elem
if (kind == GroovyResolveKind.METHOD || kind == GroovyResolveKind.PROPERTY) {
final PsiMethod method = (PsiMethod)namedElement;
final NotNullComputable<PsiSubstitutor> substitutorComputer;
PsiSubstitutor erasedSubstitutor;
if (kind == GroovyResolveKind.METHOD) {
substitutorComputer = () -> myMethodSubstitutorComputer.getValue().obtainSubstitutor(substitutor, method, resolveContext);
}
else {
erasedSubstitutor = myMethodErasedSubstitutorComputer.getValue().obtainSubstitutor(substitutor, method, resolveContext);
} else {
substitutorComputer = () -> myPropertySubstitutorComputer.getValue().obtainSubstitutor(substitutor, method, resolveContext);
erasedSubstitutor = substitutorComputer.compute();
}
final boolean isApplicable = kind == GroovyResolveKind.PROPERTY && !myIsLValue
|| isApplicable(myArgumentTypes.getValue(), method, substitutorComputer.compute(), myRef, true);
|| isApplicable(myArgumentTypes.getValue(), method, erasedSubstitutor, myRef, true);
candidate = new GroovyMethodResultImpl(
method, resolveContext, spreadState,
......@@ -358,4 +369,6 @@ public abstract class GroovyResolverProcessor implements PsiScopeProcessor, Elem
}
return erasedTypes;
}
}
......@@ -90,10 +90,9 @@ public class MethodResolverProcessor extends ResolverProcessor<GroovyMethodResul
final NotNullComputable<PsiSubstitutor> substitutorComputer =
() -> mySubstitutorComputer.obtainSubstitutor(partialSubstitutor, method, resolveContext);
PsiSubstitutor substitutor = substitutorComputer.compute();
boolean isAccessible = isAccessible(method);
boolean isStaticsOK = isStaticsOK(method, resolveContext, false);
boolean isApplicable = PsiUtil.isApplicable(myArgumentTypes, method, substitutor, myPlace, true);
boolean isApplicable = PsiUtil.isApplicable(myArgumentTypes, method, partialSubstitutor, myPlace, true);
boolean isValidResult = isStaticsOK && isAccessible && isApplicable;
GroovyMethodResultImpl candidate = new GroovyMethodResultImpl(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment