From bb0c52a8c85866aba401430e2984762d997d402e Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Fri, 24 Apr 2020 23:05:37 +0300 Subject: [PATCH] PY-41923 Don't cache extensions of Pythonid.knownDecoratorProvider GitOrigin-RevId: 91999f358b91e38d4014c8261a9ad7f247638c88 --- python/python-psi-api/resources/META-INF/PythonPsi.xml | 4 +++- .../src/com/jetbrains/python/psi/PyUtil.java | 7 ------- .../src/com/jetbrains/python/psi/impl/PyClassImpl.java | 2 +- .../src/com/jetbrains/python/psi/impl/PyFunctionImpl.java | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/python/python-psi-api/resources/META-INF/PythonPsi.xml b/python/python-psi-api/resources/META-INF/PythonPsi.xml index 4c096693020b..1e0333942f20 100644 --- a/python/python-psi-api/resources/META-INF/PythonPsi.xml +++ b/python/python-psi-api/resources/META-INF/PythonPsi.xml @@ -21,7 +21,9 @@ - + diff --git a/python/python-psi-impl/src/com/jetbrains/python/psi/PyUtil.java b/python/python-psi-impl/src/com/jetbrains/python/psi/PyUtil.java index 5d55d21857ae..4f133128a6a3 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/psi/PyUtil.java +++ b/python/python-psi-impl/src/com/jetbrains/python/psi/PyUtil.java @@ -958,13 +958,6 @@ public class PyUtil { return variables; } - public static class KnownDecoratorProviderHolder { - public static final List KNOWN_DECORATOR_PROVIDERS = PyKnownDecoratorProvider.EP_NAME.getExtensionList(); - - private KnownDecoratorProviderHolder() { - } - } - /** * If argument is a PsiDirectory, turn it into a PsiFile that points to __init__.py in that directory. * If there's no __init__.py there, null is returned, there's no point to resolve to a dir which is not a package. diff --git a/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyClassImpl.java b/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyClassImpl.java index 2b2a091e63f8..4dc67071244d 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyClassImpl.java +++ b/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyClassImpl.java @@ -692,7 +692,7 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla final QualifiedName qname = deco.getQualifiedName(); if (qname != null) { String decoName = qname.toString(); - for (PyKnownDecoratorProvider provider : PyUtil.KnownDecoratorProviderHolder.KNOWN_DECORATOR_PROVIDERS) { + for (PyKnownDecoratorProvider provider : PyKnownDecoratorProvider.EP_NAME.getExtensionList()) { final String knownName = provider.toKnownDecorator(decoName); if (knownName != null) { decoName = knownName; diff --git a/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java b/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java index e71fd89f0078..84f6b2446c84 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java +++ b/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java @@ -858,7 +858,7 @@ public class PyFunctionImpl extends PyBaseElementImpl implements if (PyNames.CLASSMETHOD.equals(deconame) || PyNames.STATICMETHOD.equals(deconame)) { return deconame; } - for (PyKnownDecoratorProvider provider : PyUtil.KnownDecoratorProviderHolder.KNOWN_DECORATOR_PROVIDERS) { + for (PyKnownDecoratorProvider provider : PyKnownDecoratorProvider.EP_NAME.getIterable()) { String name = provider.toKnownDecorator(deconame); if (name != null) { return name;