var -> explicit: don't register warnings twice

IDEA-CR-34042
This commit is contained in:
Anna Kozlova
2018-06-25 16:20:05 +03:00
parent 7a88938774
commit c318eb788b
2 changed files with 7 additions and 2 deletions

View File

@@ -35,6 +35,10 @@ public class VariableTypeCanBeExplicitInspection extends AbstractBaseJavaLocalIn
@Override
public void visitVariable(PsiVariable variable) {
if (variable instanceof PsiParameter &&
((PsiParameter)variable).getDeclarationScope() instanceof PsiLambdaExpression) {
return;
}
PsiTypeElement typeElement = getTypeElementToExpand(variable);
if (typeElement != null) {
registerTypeElementProblem(typeElement);

View File

@@ -1,5 +1,6 @@
// "Replace 'var' with explicit type" "false"
final class Example<J, T> {
interface I<A, B> {
void m(A a, B b);
}
@@ -7,6 +8,6 @@ final class Example<J, T> {
void m(I<T, J> i) {}
void m(Example<? super String, Integer> e) {
e.m((var a, <caret>var b) -> {});
e.m((v<caret>ar a, var b) -> {});
}
}
}