diff --git a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyClassStub.java b/python/psi-api/src/com/jetbrains/python/psi/stubs/PyClassStub.java index 5f90dad8e8fe..e4f428cd91c1 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyClassStub.java +++ b/python/psi-api/src/com/jetbrains/python/psi/stubs/PyClassStub.java @@ -22,7 +22,6 @@ package com.jetbrains.python.psi.stubs; import com.intellij.psi.stubs.NamedStub; import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.psi.PyClass; -import com.jetbrains.python.psi.impl.stubs.PyCustomClassStub; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -69,15 +68,12 @@ public interface PyClassStub extends NamedStub { } /** - * @param stubClass custom stub class - * @param custom stub class - * @return saved stub if it is an instance of passed class or null. - * @apiNote This method will be marked as abstract in 2019.2. - * @see PyCustomClassStub - * @see com.jetbrains.python.psi.impl.stubs.PyCustomClassStubType + * @deprecated It is our internal API, try to avoid using it. + * It is planned to be removed sooner or later, so please don't rely on this method. */ + @Deprecated @Nullable - default T getCustomStub(@NotNull Class stubClass) { + default T getCustomStub(@NotNull Class stubClass) { return null; } } \ No newline at end of file diff --git a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyTargetExpressionStub.java b/python/psi-api/src/com/jetbrains/python/psi/stubs/PyTargetExpressionStub.java index da710a3d44de..fd02413fd30d 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyTargetExpressionStub.java +++ b/python/psi-api/src/com/jetbrains/python/psi/stubs/PyTargetExpressionStub.java @@ -18,7 +18,6 @@ package com.jetbrains.python.psi.stubs; import com.intellij.psi.stubs.NamedStub; import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.psi.PyTargetExpression; -import com.jetbrains.python.psi.impl.stubs.CustomTargetExpressionStub; import org.jetbrains.annotations.Nullable; /** @@ -58,8 +57,13 @@ public interface PyTargetExpressionStub extends NamedStub, P boolean isQualified(); + /** + * @deprecated It is our internal API, try to avoid using it. + * It is planned to be removed sooner or later, so please don't rely on this method. + */ + @Deprecated @Nullable - T getCustomStub(Class stubClass); + T getCustomStub(Class stubClass); @Nullable String getDocString(); diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStub.java b/python/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStub.java similarity index 100% rename from python/psi-api/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStub.java rename to python/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStub.java diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStubType.java b/python/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStubType.java similarity index 88% rename from python/psi-api/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStubType.java rename to python/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStubType.java index 818b5cd30459..cbfd2afbf45f 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStubType.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/CustomTargetExpressionStubType.java @@ -26,6 +26,11 @@ import com.jetbrains.python.psi.stubs.PyTargetExpressionStub; public abstract class CustomTargetExpressionStubType implements PyCustomStubType { + /** + * @deprecated It is our internal API, try to avoid using it. + * It is planned to be removed sooner or later, so please don't rely on this EP. + */ + @Deprecated public static final ExtensionPointName> EP_NAME = ExtensionPointName.create("Pythonid.customTargetExpressionStubType"); diff --git a/python/src/com/jetbrains/python/psi/impl/stubs/PyClassStubImpl.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyClassStubImpl.java index 0109bf9e6f4e..327044e09b3b 100644 --- a/python/src/com/jetbrains/python/psi/impl/stubs/PyClassStubImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyClassStubImpl.java @@ -140,7 +140,7 @@ public class PyClassStubImpl extends StubBase implements PyClassStub { @Nullable @Override - public T getCustomStub(@NotNull Class stubClass) { + public T getCustomStub(@NotNull Class stubClass) { return ObjectUtils.tryCast(myCustomStub, stubClass); } diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStub.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStub.java similarity index 100% rename from python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStub.java rename to python/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStub.java diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStubType.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStubType.java similarity index 76% rename from python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStubType.java rename to python/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStubType.java index 2dcfee0d5dcb..c7017435e883 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStubType.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomClassStubType.java @@ -6,6 +6,11 @@ import com.jetbrains.python.psi.PyClass; public abstract class PyCustomClassStubType implements PyCustomStubType { + /** + * @deprecated It is our internal API, try to avoid using it. + * It is planned to be removed sooner or later, so please don't rely on this EP. + */ + @Deprecated public static final ExtensionPointName> EP_NAME = ExtensionPointName.create("Pythonid.customClassStubType"); } diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomStub.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomStub.java similarity index 90% rename from python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomStub.java rename to python/src/com/jetbrains/python/psi/impl/stubs/PyCustomStub.java index f6bf9e83b6e6..5494197fb9e9 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomStub.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomStub.java @@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; -public interface PyCustomStub { +interface PyCustomStub { /** * @return type class to distinguish one custom stub from another. diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomStubType.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomStubType.java similarity index 91% rename from python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomStubType.java rename to python/src/com/jetbrains/python/psi/impl/stubs/PyCustomStubType.java index 295851e95d1e..5e38c1250cbb 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/impl/stubs/PyCustomStubType.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomStubType.java @@ -9,7 +9,7 @@ import org.jetbrains.annotations.Nullable; import java.io.IOException; -public interface PyCustomStubType { +interface PyCustomStubType { /** * @param psi element to create stub for diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyCustomizableStubElementType.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomizableStubElementType.java similarity index 82% rename from python/psi-api/src/com/jetbrains/python/psi/PyCustomizableStubElementType.java rename to python/src/com/jetbrains/python/psi/impl/stubs/PyCustomizableStubElementType.java index a1dccab8b600..9832cc8d903c 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/PyCustomizableStubElementType.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyCustomizableStubElementType.java @@ -1,17 +1,16 @@ // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.jetbrains.python.psi; +package com.jetbrains.python.psi.impl.stubs; import com.intellij.psi.stubs.StubInputStream; import com.intellij.psi.stubs.StubOutputStream; -import com.jetbrains.python.psi.impl.stubs.PyCustomStub; -import com.jetbrains.python.psi.impl.stubs.PyCustomStubType; +import com.jetbrains.python.psi.PyElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.List; -public interface PyCustomizableStubElementType> { +interface PyCustomizableStubElementType> { @NotNull List getExtensions(); diff --git a/python/src/com/jetbrains/python/psi/impl/stubs/PyTargetExpressionStubImpl.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyTargetExpressionStubImpl.java index 5406b947b178..5feb34aae759 100644 --- a/python/src/com/jetbrains/python/psi/impl/stubs/PyTargetExpressionStubImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyTargetExpressionStubImpl.java @@ -17,9 +17,9 @@ package com.jetbrains.python.psi.impl.stubs; import com.intellij.psi.stubs.StubBase; import com.intellij.psi.stubs.StubElement; +import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.PyElementTypes; import com.jetbrains.python.psi.PyTargetExpression; -import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.psi.stubs.PyTargetExpressionStub; import org.jetbrains.annotations.Nullable; @@ -101,7 +101,7 @@ public class PyTargetExpressionStubImpl extends StubBase imp @Nullable @Override - public T getCustomStub(Class stubClass) { + public T getCustomStub(Class stubClass) { if (stubClass.isInstance(myCustomStub)) { return stubClass.cast(myCustomStub); } diff --git a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyDataclassFieldStub.java b/python/src/com/jetbrains/python/psi/stubs/PyDataclassFieldStub.java similarity index 100% rename from python/psi-api/src/com/jetbrains/python/psi/stubs/PyDataclassFieldStub.java rename to python/src/com/jetbrains/python/psi/stubs/PyDataclassFieldStub.java diff --git a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyDataclassStub.java b/python/src/com/jetbrains/python/psi/stubs/PyDataclassStub.java similarity index 100% rename from python/psi-api/src/com/jetbrains/python/psi/stubs/PyDataclassStub.java rename to python/src/com/jetbrains/python/psi/stubs/PyDataclassStub.java diff --git a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyNamedTupleStub.java b/python/src/com/jetbrains/python/psi/stubs/PyNamedTupleStub.java similarity index 100% rename from python/psi-api/src/com/jetbrains/python/psi/stubs/PyNamedTupleStub.java rename to python/src/com/jetbrains/python/psi/stubs/PyNamedTupleStub.java diff --git a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyTypingAliasStub.java b/python/src/com/jetbrains/python/psi/stubs/PyTypingAliasStub.java similarity index 100% rename from python/psi-api/src/com/jetbrains/python/psi/stubs/PyTypingAliasStub.java rename to python/src/com/jetbrains/python/psi/stubs/PyTypingAliasStub.java diff --git a/python/psi-api/src/com/jetbrains/python/psi/stubs/PyTypingNewTypeStub.java b/python/src/com/jetbrains/python/psi/stubs/PyTypingNewTypeStub.java similarity index 100% rename from python/psi-api/src/com/jetbrains/python/psi/stubs/PyTypingNewTypeStub.java rename to python/src/com/jetbrains/python/psi/stubs/PyTypingNewTypeStub.java