mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-10881 Method may be static false positive on abc.abstractproperty
This commit is contained in:
@@ -57,8 +57,7 @@ public class PyMethodMayBeStaticInspection extends PyInspection {
|
||||
if (decoratorList != null) {
|
||||
for (PyDecorator decorator : decoratorList.getDecorators()) {
|
||||
final String decoratorName = decorator.getName();
|
||||
if (PyNames.STATICMETHOD.equals(decoratorName) || PyNames.CLASSMETHOD.equals(decoratorName) ||
|
||||
PyNames.ABSTRACTMETHOD.equals(decoratorName)) {
|
||||
if (hasSpecificDecorator(decoratorName)) {
|
||||
return;
|
||||
}
|
||||
final Property property = containingClass.findPropertyByCallable(node);
|
||||
@@ -121,5 +120,9 @@ public class PyMethodMayBeStaticInspection extends PyInspection {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasSpecificDecorator(String decoratorName) {
|
||||
return PyNames.STATICMETHOD.equals(decoratorName) || PyNames.CLASSMETHOD.equals(decoratorName) ||
|
||||
PyNames.ABSTRACTMETHOD.equals(decoratorName) || PyNames.ABSTRACTPROPERTY.equals(decoratorName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
__author__ = 'ktisha'
|
||||
import abc
|
||||
|
||||
|
||||
class A(object):
|
||||
@abc.abstractproperty
|
||||
def foo(self):
|
||||
print ""
|
||||
@@ -55,6 +55,10 @@ public class PyMethodMayBeStaticInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAbstractProperty() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile("inspections/PyMethodMayBeStaticInspection/" + getTestName(true) + ".py");
|
||||
myFixture.enableInspections(PyMethodMayBeStaticInspection.class);
|
||||
|
||||
Reference in New Issue
Block a user