mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ignore assignments from lambdas in "Constructor assigns value to field defined in superclass" inspection
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,7 +77,7 @@ public class AssignmentToSuperclassFieldInspection extends BaseInspection {
|
||||
if (!(expression instanceof PsiReferenceExpression)) {
|
||||
return;
|
||||
}
|
||||
final PsiMethod method = PsiTreeUtil.getParentOfType(expression, PsiMethod.class, true, PsiClass.class);
|
||||
final PsiMethod method = PsiTreeUtil.getParentOfType(expression, PsiMethod.class, true, PsiClass.class, PsiLambdaExpression.class);
|
||||
if (method == null || !method.isConstructor()) {
|
||||
return;
|
||||
}
|
||||
|
||||
+4
@@ -21,5 +21,9 @@ class B extends AssignmentToSuperclassField {
|
||||
<warning descr="Assignment to field 'j' defined in superclass 'AssignmentToSuperclassField'">this.j</warning> = 4;
|
||||
<warning descr="Assignment to field 'k' defined in superclass 'AssignmentToSuperclassField'">super.k</warning>++;
|
||||
z = 100;
|
||||
Runnable r = () -> i = 6;
|
||||
new Object() {{
|
||||
i = 4;
|
||||
}};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user