GitOrigin-RevId: 9cb238c220249088bfc75a448eb310b93c7fc45c
This commit is contained in:
Vladimir Krivosheev
2024-12-25 21:07:36 +01:00
committed by intellij-monorepo-bot
parent c760e695b8
commit 68d99c6550
847 changed files with 4900 additions and 8833 deletions

View File

@@ -13,10 +13,10 @@ import org.jetbrains.annotations.NotNull;
public class JavaPythonFacet extends LibraryContributingFacet<JavaPythonFacetConfiguration> {
public static final FacetTypeId<JavaPythonFacet> ID = new FacetTypeId<>("python");
public JavaPythonFacet(@NotNull final FacetType facetType,
@NotNull final Module module,
@NotNull final String name,
@NotNull final JavaPythonFacetConfiguration configuration,
public JavaPythonFacet(final @NotNull FacetType facetType,
final @NotNull Module module,
final @NotNull String name,
final @NotNull JavaPythonFacetConfiguration configuration,
Facet underlyingFacet) {
super(facetType, module, name, configuration, underlyingFacet);
}

View File

@@ -21,8 +21,7 @@ import java.util.List;
@ApiStatus.Internal
public final class JavaPythonFacetType extends FacetType<JavaPythonFacet, JavaPythonFacetConfiguration> {
@NonNls
private static final String ID = "Python";
private static final @NonNls String ID = "Python";
public static JavaPythonFacetType getInstance() {
return findInstance(JavaPythonFacetType.class);

View File

@@ -27,12 +27,11 @@ final class PyProjectStructureDetector extends ProjectStructureDetector {
public static final @NlsSafe String PYTHON = "Python";
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
File @NotNull [] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
public @NotNull DirectoryProcessingResult detectRoots(@NotNull File dir,
File @NotNull [] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
LOG.info("Detecting roots under " + dir);
for (File child : children) {
final String name = child.getName();

View File

@@ -23,9 +23,8 @@ final class PythonFrameworkSupportProvider extends FrameworkSupportProvider {
return PythonPsiApiIcons.Python;
}
@NotNull
@Override
public FrameworkSupportConfigurable createConfigurable(@NotNull FrameworkSupportModel model) {
public @NotNull FrameworkSupportConfigurable createConfigurable(@NotNull FrameworkSupportModel model) {
return new PythonFrameworkSupportConfigurable(model);
}

View File

@@ -8,8 +8,7 @@ import org.jetbrains.annotations.NotNull;
final class PythonModuleType extends PythonModuleTypeBase<PythonModuleBuilderBase> {
@Override
@NotNull
public PythonModuleBuilder createModuleBuilder() {
public @NotNull PythonModuleBuilder createModuleBuilder() {
return new PythonModuleBuilder();
}
}

View File

@@ -45,14 +45,12 @@ public class PythonSdkEditorTab extends FacetEditorTab {
}
@Override
@Nls
public String getDisplayName() {
public @Nls String getDisplayName() {
return PyBundle.message("configurable.PythonSdkEditorTab.display.name");
}
@Override
@NotNull
public JComponent createComponent() {
public @NotNull JComponent createComponent() {
return myMainPanel;
}

View File

@@ -30,21 +30,19 @@ public class PyJavaClassType implements PyClassLikeType {
}
@Override
@Nullable
public List<? extends RatedResolveResult> resolveMember(@NotNull final String name,
@Nullable PyExpression location,
@NotNull AccessDirection direction,
@NotNull PyResolveContext resolveContext) {
public @Nullable List<? extends RatedResolveResult> resolveMember(final @NotNull String name,
@Nullable PyExpression location,
@NotNull AccessDirection direction,
@NotNull PyResolveContext resolveContext) {
return resolveMember(name, location, direction, resolveContext, true);
}
@Nullable
@Override
public List<? extends RatedResolveResult> resolveMember(@NotNull String name,
@Nullable PyExpression location,
@NotNull AccessDirection direction,
@NotNull PyResolveContext resolveContext,
boolean inherited) {
public @Nullable List<? extends RatedResolveResult> resolveMember(@NotNull String name,
@Nullable PyExpression location,
@NotNull AccessDirection direction,
@NotNull PyResolveContext resolveContext,
boolean inherited) {
final PsiMethod[] methods = myClass.findMethodsByName(name, inherited);
if (methods.length > 0) {
ResolveResultList resultList = new ResolveResultList();
@@ -66,8 +64,7 @@ public class PyJavaClassType implements PyClassLikeType {
}
@Override
@Nullable
public String getName() {
public @Nullable String getName() {
if (myClass != null) {
return myClass.getName();
}
@@ -90,18 +87,16 @@ public class PyJavaClassType implements PyClassLikeType {
return myDefinition;
}
@Nullable
@Override
public PyType getReturnType(@NotNull TypeEvalContext context) {
public @Nullable PyType getReturnType(@NotNull TypeEvalContext context) {
if (myDefinition) {
return new PyJavaClassType(myClass, false);
}
return null;
}
@Nullable
@Override
public PyType getCallType(@NotNull TypeEvalContext context, @NotNull PyCallSiteExpression callSite) {
public @Nullable PyType getCallType(@NotNull TypeEvalContext context, @NotNull PyCallSiteExpression callSite) {
return getReturnType(context);
}
@@ -110,27 +105,23 @@ public class PyJavaClassType implements PyClassLikeType {
return myDefinition;
}
@NotNull
@Override
public PyClassLikeType toInstance() {
public @NotNull PyClassLikeType toInstance() {
return myDefinition ? new PyJavaClassType(myClass, false) : this;
}
@NotNull
@Override
public PyClassLikeType toClass() {
public @NotNull PyClassLikeType toClass() {
return myDefinition ? this : new PyJavaClassType(myClass, true);
}
@Nullable
@Override
public String getClassQName() {
public @Nullable String getClassQName() {
return myClass.getQualifiedName();
}
@NotNull
@Override
public List<PyClassLikeType> getSuperClassTypes(@NotNull TypeEvalContext context) {
public @NotNull List<PyClassLikeType> getSuperClassTypes(@NotNull TypeEvalContext context) {
final List<PyClassLikeType> result = new ArrayList<>();
for (PsiClass cls : myClass.getSupers()) {
result.add(new PyJavaClassType(cls, myDefinition));
@@ -159,9 +150,8 @@ public class PyJavaClassType implements PyClassLikeType {
}
}
@NotNull
@Override
public Set<String> getMemberNames(boolean inherited, @NotNull TypeEvalContext context) {
public @NotNull Set<String> getMemberNames(boolean inherited, @NotNull TypeEvalContext context) {
final Set<String> result = new LinkedHashSet<>();
for (PsiMethod method : myClass.getAllMethods()) {
@@ -183,9 +173,8 @@ public class PyJavaClassType implements PyClassLikeType {
return result;
}
@NotNull
@Override
public List<PyClassLikeType> getAncestorTypes(@NotNull final TypeEvalContext context) {
public @NotNull List<PyClassLikeType> getAncestorTypes(final @NotNull TypeEvalContext context) {
final List<PyClassLikeType> result = new ArrayList<>();
final Deque<PsiClass> deque = new LinkedList<>();
@@ -213,9 +202,8 @@ public class PyJavaClassType implements PyClassLikeType {
return myClass.isValid();
}
@Nullable
@Override
public PyClassLikeType getMetaClassType(@NotNull TypeEvalContext context, boolean inherited) {
public @Nullable PyClassLikeType getMetaClassType(@NotNull TypeEvalContext context, boolean inherited) {
return null;
}

View File

@@ -19,8 +19,7 @@ import org.jetbrains.annotations.Nullable;
public final class PyJavaImportResolver implements PyImportResolver {
@Override
@Nullable
public PsiElement resolveImportReference(@NotNull QualifiedName name, @NotNull PyQualifiedNameResolveContext context, boolean withRoots) {
public @Nullable PsiElement resolveImportReference(@NotNull QualifiedName name, @NotNull PyQualifiedNameResolveContext context, boolean withRoots) {
String fqn = name.toString();
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(context.getProject());
final PsiPackage aPackage = psiFacade.findPackage(fqn);

View File

@@ -28,24 +28,21 @@ public class PyJavaMethodType implements PyCallableType {
myMethod = method;
}
@Nullable
@Override
public PyType getReturnType(@NotNull TypeEvalContext context) {
public @Nullable PyType getReturnType(@NotNull TypeEvalContext context) {
return PyJavaTypeProvider.asPyType(myMethod.getReturnType());
}
@Nullable
@Override
public PyType getCallType(@NotNull TypeEvalContext context, @NotNull PyCallSiteExpression callSite) {
public @Nullable PyType getCallType(@NotNull TypeEvalContext context, @NotNull PyCallSiteExpression callSite) {
return getReturnType(context);
}
@Nullable
@Override
public List<? extends RatedResolveResult> resolveMember(@NotNull String name,
@Nullable PyExpression location,
@NotNull AccessDirection direction,
@NotNull PyResolveContext resolveContext) {
public @Nullable List<? extends RatedResolveResult> resolveMember(@NotNull String name,
@Nullable PyExpression location,
@NotNull AccessDirection direction,
@NotNull PyResolveContext resolveContext) {
return Collections.emptyList();
}
@@ -54,9 +51,8 @@ public class PyJavaMethodType implements PyCallableType {
return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
}
@Nullable
@Override
public String getName() {
public @Nullable String getName() {
final PsiClass cls = myMethod.getContainingClass();
return "Java method(" + (cls != null ? cls.getQualifiedName() : null) + "." + myMethod.getName() + ")";
}

View File

@@ -27,7 +27,7 @@ import java.util.List;
public class PyJavaPackageType implements PyType {
private final PsiPackage myPackage;
@Nullable private final Module myModule;
private final @Nullable Module myModule;
public PyJavaPackageType(PsiPackage aPackage, @Nullable Module module) {
myPackage = aPackage;

View File

@@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull;
public final class PyJavaSuperMethodsSearchExecutor implements QueryExecutor<PsiElement, PySuperMethodsSearch.SearchParameters> {
@Override
public boolean execute(@NotNull final PySuperMethodsSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiElement> consumer) {
public boolean execute(final @NotNull PySuperMethodsSearch.SearchParameters queryParameters, final @NotNull Processor<? super PsiElement> consumer) {
PyFunction func = queryParameters.getDerivedMethod();
PyClass containingClass = func.getContainingClass();
if (containingClass != null) {

View File

@@ -23,8 +23,7 @@ import java.util.List;
public final class PyJavaTypeProvider extends PyTypeProviderBase {
@Override
@Nullable
public Ref<PyType> getReferenceType(@NotNull PsiElement referenceTarget, @NotNull TypeEvalContext context, @Nullable PsiElement anchor) {
public @Nullable Ref<PyType> getReferenceType(@NotNull PsiElement referenceTarget, @NotNull TypeEvalContext context, @Nullable PsiElement anchor) {
if (referenceTarget instanceof PsiClass) {
return Ref.create(new PyJavaClassType((PsiClass)referenceTarget, true));
}
@@ -41,8 +40,7 @@ public final class PyJavaTypeProvider extends PyTypeProviderBase {
return null;
}
@Nullable
public static PyType asPyType(@Nullable PsiType type) {
public static @Nullable PyType asPyType(@Nullable PsiType type) {
if (type instanceof PsiClassType classType) {
final PsiClass psiClass = classType.resolve();
if (psiClass != null) {
@@ -53,8 +51,8 @@ public final class PyJavaTypeProvider extends PyTypeProviderBase {
}
@Override
public Ref<PyType> getParameterType(@NotNull final PyNamedParameter param,
@NotNull final PyFunction func,
public Ref<PyType> getParameterType(final @NotNull PyNamedParameter param,
final @NotNull PyFunction func,
@NotNull TypeEvalContext context) {
if (!(param.getParent() instanceof PyParameterList)) return null;
List<PyNamedParameter> params = ParamHelper.collectNamedParameters((PyParameterList) param.getParent());