mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
var -> explicit: don't register warnings twice
IDEA-CR-34042
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) -> {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user