mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-13884 "Override Methods" loses @staticmethod decorator from parent
This commit is contained in:
@@ -183,8 +183,11 @@ public class PyOverrideImplementUtil {
|
||||
private static PyFunctionBuilder buildOverriddenFunction(PyClass pyClass, PyFunction baseFunction, boolean implement) {
|
||||
PyFunctionBuilder pyFunctionBuilder = new PyFunctionBuilder(baseFunction.getName());
|
||||
final PyDecoratorList decorators = baseFunction.getDecoratorList();
|
||||
if (decorators != null && decorators.findDecorator(PyNames.CLASSMETHOD) != null) {
|
||||
pyFunctionBuilder.decorate(PyNames.CLASSMETHOD);
|
||||
if (decorators != null) {
|
||||
if (decorators.findDecorator(PyNames.CLASSMETHOD) != null)
|
||||
pyFunctionBuilder.decorate(PyNames.CLASSMETHOD);
|
||||
else if (decorators.findDecorator(PyNames.STATICMETHOD) != null)
|
||||
pyFunctionBuilder.decorate(PyNames.STATICMETHOD);
|
||||
}
|
||||
PyAnnotation anno = baseFunction.getAnnotation();
|
||||
if (anno != null) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class A:
|
||||
@staticmethod
|
||||
def foo(cls):
|
||||
cls.k = 3
|
||||
|
||||
class B(A):
|
||||
<caret>pass
|
||||
@@ -0,0 +1,9 @@
|
||||
class A:
|
||||
@staticmethod
|
||||
def foo(cls):
|
||||
cls.k = 3
|
||||
|
||||
class B(A):
|
||||
@staticmethod
|
||||
def foo(cls):
|
||||
<selection>A.foo(cls)</selection>
|
||||
@@ -64,6 +64,10 @@ public class PyOverrideTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStaticMethod() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNewStyle() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user