mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-137173 (Message "Parameter 'foo' hides field in class 'bar'" provided, even though no hiding is ocurring)
This commit is contained in:
+4
-1
@@ -34,7 +34,7 @@ public class ParameterHidingMemberVariableInspectionBase extends BaseInspection
|
||||
public boolean m_ignoreInvisibleFields = true;
|
||||
|
||||
@SuppressWarnings("PublicField")
|
||||
public boolean m_ignoreStaticMethodParametersHidingInstanceFields = false;
|
||||
public boolean m_ignoreStaticMethodParametersHidingInstanceFields = true;
|
||||
|
||||
@SuppressWarnings("PublicField")
|
||||
public boolean m_ignoreForConstructors = false;
|
||||
@@ -150,6 +150,9 @@ public class ParameterHidingMemberVariableInspectionBase extends BaseInspection
|
||||
(!m_ignoreInvisibleFields || ClassUtils.isFieldVisible(field, aClass))) {
|
||||
return aClass;
|
||||
}
|
||||
if (aClass.hasModifierProperty(PsiModifier.STATIC) && m_ignoreStaticMethodParametersHidingInstanceFields) {
|
||||
return null;
|
||||
}
|
||||
aClass = ClassUtils.getContainingClass(aClass);
|
||||
}
|
||||
return null;
|
||||
|
||||
+12
@@ -5,6 +5,18 @@ or surrounding classes if it is a parameter inside of an inner or anonymous clas
|
||||
Such a parameter name may be confusing.
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
Use the first checkbox to ignore parameters of simple setters.
|
||||
<p>
|
||||
Use the second checkbox to ignore for private fields in a superclass, which are not visible from the parameter.
|
||||
<p>
|
||||
Use the third checkbox to ignore parameters of constructors.
|
||||
<p>
|
||||
Use the fourth checkbox to ignore parameters of abstract methods.
|
||||
<p>
|
||||
Use the fifth checkbox to ignore parameters of <b>static</b> methods hiding an instance field and
|
||||
to ignore parameters of instance methods in static inner classes hiding an instance field in an outer class.
|
||||
While not strictly hiding, such parameters can still be confusing.
|
||||
<p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+9
@@ -34,4 +34,13 @@ public class ParameterHidingMemberVariable
|
||||
public static void setBar2(int bar) {
|
||||
System.out.println(bar);
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
class X {
|
||||
void m(int <warning descr="Parameter 'i' hides field in class 'ParameterHidingMemberVariable'">i</warning>) {}
|
||||
}
|
||||
static class Y {
|
||||
void a(int i) {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user