GitOrigin-RevId: 6fa4f979e0a6641885e2225eb985b13713373ac5
This commit is contained in:
Vladimir Krivosheev
2024-12-25 19:38:36 +01:00
committed by intellij-monorepo-bot
parent e82d6f4b86
commit 051ed2529b
2577 changed files with 12644 additions and 24993 deletions

View File

@@ -30,8 +30,7 @@ public interface JavaModuleSystemEx extends JavaModuleSystem {
}
}
@Nullable
default ErrorWithFixes checkAccess(@NotNull PsiClass target, @NotNull PsiElement place) {
default @Nullable ErrorWithFixes checkAccess(@NotNull PsiClass target, @NotNull PsiElement place) {
String packageName = PsiUtil.getPackageName(target);
return packageName != null ? checkAccess(packageName, target.getContainingFile(), place) : null;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.intention;
import com.intellij.codeInspection.LocalQuickFix;
@@ -30,8 +30,7 @@ public abstract class QuickFixFactory {
* <p>
* Usage of this method might be unsafe in case of fixing java multi variable declaration modifier list
*/
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierList modifierList,
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierList modifierList,
@PsiModifier.ModifierConstant @NotNull String modifier,
boolean shouldHave,
final boolean showContainingClass);
@@ -40,119 +39,92 @@ public abstract class QuickFixFactory {
* @see JvmElementActionsFactory#createChangeModifierActions(com.intellij.lang.jvm.JvmModifiersOwner, com.intellij.lang.jvm.actions.ChangeModifierRequest
* for jvm language transparent fix
*/
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierListOwner owner,
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierListOwner owner,
@PsiModifier.ModifierConstant @NotNull String modifier,
boolean shouldHave,
final boolean showContainingClass);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createMethodReturnFix(@NotNull PsiMethod method,
@NotNull PsiType toReturn,
boolean fixWholeHierarchy);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createMethodReturnFix(@NotNull PsiMethod method,
@NotNull PsiType toReturn,
boolean fixWholeHierarchy);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createMethodReturnFix(@NotNull PsiMethod method,
@NotNull PsiType toReturn,
boolean fixWholeHierarchy,
boolean suggestSuperTypes);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createMethodReturnFix(@NotNull PsiMethod method,
@NotNull PsiType toReturn,
boolean fixWholeHierarchy,
boolean suggestSuperTypes);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAnnotationMethodReturnFix(@NotNull PsiMethod method,
@NotNull PsiType toReturn,
boolean fromDefaultValue);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createAnnotationMethodReturnFix(@NotNull PsiMethod method,
@NotNull PsiType toReturn,
boolean fromDefaultValue);
/**
* @param psiElement psiClass or enum constant without class initializer
*/
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiElement psiElement);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiElement psiElement);
@NotNull
public abstract IntentionAction createAssignmentToComparisonFix(@NotNull PsiAssignmentExpression expr);
public abstract @NotNull IntentionAction createAssignmentToComparisonFix(@NotNull PsiAssignmentExpression expr);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiClass psiElement);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiClass psiElement);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createMethodThrowsFix(@NotNull PsiMethod method,
@NotNull PsiClassType exceptionClass,
boolean shouldThrow,
boolean showContainingClass);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createMethodThrowsFix(@NotNull PsiMethod method,
@NotNull PsiClassType exceptionClass,
boolean shouldThrow,
boolean showContainingClass);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAddDefaultConstructorFix(@NotNull PsiClass aClass);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createAddDefaultConstructorFix(@NotNull PsiClass aClass);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createMethodParameterTypeFix(@NotNull PsiMethod method,
int index,
@NotNull PsiType newType,
boolean fixWholeHierarchy);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createMethodParameterTypeFix(@NotNull PsiMethod method,
int index,
@NotNull PsiType newType,
boolean fixWholeHierarchy);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createExtendsListFix(@NotNull PsiClass aClass,
@NotNull PsiClassType typeToExtendFrom,
boolean toAdd);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createExtendsListFix(@NotNull PsiClass aClass,
@NotNull PsiClassType typeToExtendFrom,
boolean toAdd);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createRemoveUnusedParameterFix(@NotNull PsiParameter parameter);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createRemoveUnusedParameterFix(@NotNull PsiParameter parameter);
@NotNull
public abstract IntentionAction createRemoveUnusedVariableFix(@NotNull PsiVariable variable);
public abstract @NotNull IntentionAction createRemoveUnusedVariableFix(@NotNull PsiVariable variable);
@Nullable
public abstract IntentionAction createCreateClassOrPackageFix(@NotNull PsiElement context,
@NotNull String qualifiedName,
final boolean createClass,
final String superClass);
public abstract @Nullable IntentionAction createCreateClassOrPackageFix(@NotNull PsiElement context,
@NotNull String qualifiedName,
final boolean createClass,
final String superClass);
@Nullable
public abstract IntentionAction createCreateClassOrInterfaceFix(@NotNull PsiElement context,
@NotNull String qualifiedName,
final boolean createClass,
final String superClass);
public abstract @Nullable IntentionAction createCreateClassOrInterfaceFix(@NotNull PsiElement context,
@NotNull String qualifiedName,
final boolean createClass,
final String superClass);
@NotNull
public abstract IntentionAction createCreateFieldOrPropertyFix(@NotNull PsiClass aClass,
@NotNull String name,
@NotNull PsiType type,
@NotNull PropertyMemberType targetMember,
PsiAnnotation @NotNull ... annotations);
public abstract @NotNull IntentionAction createCreateFieldOrPropertyFix(@NotNull PsiClass aClass,
@NotNull String name,
@NotNull PsiType type,
@NotNull PropertyMemberType targetMember,
PsiAnnotation @NotNull ... annotations);
@NotNull
public abstract IntentionAction createAddExceptionToCatchFix();
public abstract @NotNull IntentionAction createAddExceptionToCatchFix();
@NotNull
public abstract IntentionAction createAddExceptionToThrowsFix(@NotNull PsiElement element);
public abstract @NotNull IntentionAction createAddExceptionToThrowsFix(@NotNull PsiElement element);
@NotNull
public abstract IntentionAction createAddExceptionFromFieldInitializerToConstructorThrowsFix(@NotNull PsiElement element);
public abstract @NotNull IntentionAction createAddExceptionFromFieldInitializerToConstructorThrowsFix(@NotNull PsiElement element);
@NotNull
public abstract IntentionAction createSurroundWithTryCatchFix(@NotNull PsiElement element);
public abstract @NotNull IntentionAction createSurroundWithTryCatchFix(@NotNull PsiElement element);
@NotNull
public abstract IntentionAction createAddExceptionToExistingCatch(@NotNull PsiElement element);
public abstract @NotNull IntentionAction createAddExceptionToExistingCatch(@NotNull PsiElement element);
@NotNull
public abstract IntentionAction createChangeToAppendFix(@NotNull IElementType sign,
@NotNull PsiType type,
@NotNull PsiAssignmentExpression assignment);
public abstract @NotNull IntentionAction createChangeToAppendFix(@NotNull IElementType sign,
@NotNull PsiType type,
@NotNull PsiAssignmentExpression assignment);
@NotNull
public abstract IntentionAction createAddTypeCastFix(@NotNull PsiType type, @NotNull PsiExpression expression);
public abstract @NotNull IntentionAction createAddTypeCastFix(@NotNull PsiType type, @NotNull PsiExpression expression);
@NotNull
public abstract IntentionAction createReuseVariableDeclarationFix(@NotNull PsiLocalVariable variable);
public abstract @NotNull IntentionAction createReuseVariableDeclarationFix(@NotNull PsiLocalVariable variable);
@NotNull
public abstract IntentionAction createNavigateToAlreadyDeclaredVariableFix(@NotNull PsiVariable variable);
public abstract @NotNull IntentionAction createNavigateToAlreadyDeclaredVariableFix(@NotNull PsiVariable variable);
@NotNull
public abstract IntentionAction createNavigateToDuplicateElementFix(@NotNull NavigatablePsiElement element);
public abstract @NotNull IntentionAction createNavigateToDuplicateElementFix(@NotNull NavigatablePsiElement element);
@NotNull
public abstract IntentionAction createConvertToStringLiteralAction();
public abstract @NotNull IntentionAction createConvertToStringLiteralAction();
/**
* Provides fix to remove return statement or return value in case when return statement is not last statement in block.
@@ -160,247 +132,176 @@ public abstract class QuickFixFactory {
* @param method method with return statement
* @param returnStatement statement to remove
*/
@NotNull
public abstract IntentionAction createDeleteReturnFix(@NotNull PsiMethod method, @NotNull PsiReturnStatement returnStatement);
public abstract @NotNull IntentionAction createDeleteReturnFix(@NotNull PsiMethod method, @NotNull PsiReturnStatement returnStatement);
@NotNull
public abstract IntentionAction createDeleteCatchFix(@NotNull PsiParameter parameter);
public abstract @NotNull IntentionAction createDeleteCatchFix(@NotNull PsiParameter parameter);
@NotNull
public abstract IntentionAction createDeleteMultiCatchFix(@NotNull PsiTypeElement element);
public abstract @NotNull IntentionAction createDeleteMultiCatchFix(@NotNull PsiTypeElement element);
@NotNull
public abstract IntentionAction createConvertSwitchToIfIntention(@NotNull PsiSwitchStatement statement);
public abstract @NotNull IntentionAction createConvertSwitchToIfIntention(@NotNull PsiSwitchStatement statement);
@NotNull
public abstract IntentionAction createNegationBroadScopeFix(@NotNull PsiPrefixExpression expr);
public abstract @NotNull IntentionAction createNegationBroadScopeFix(@NotNull PsiPrefixExpression expr);
@NotNull
public abstract IntentionAction createCreateFieldFromUsageFix(@NotNull PsiReferenceExpression place);
public abstract @NotNull IntentionAction createCreateFieldFromUsageFix(@NotNull PsiReferenceExpression place);
@NotNull
public abstract IntentionAction createReplaceWithListAccessFix(@NotNull PsiArrayAccessExpression expression);
public abstract @NotNull IntentionAction createReplaceWithListAccessFix(@NotNull PsiArrayAccessExpression expression);
@NotNull
public abstract IntentionAction createAddNewArrayExpressionFix(@NotNull PsiArrayInitializerExpression expression);
public abstract @NotNull IntentionAction createAddNewArrayExpressionFix(@NotNull PsiArrayInitializerExpression expression);
@NotNull
public abstract IntentionAction createMoveCatchUpFix(@NotNull PsiCatchSection section, @NotNull PsiCatchSection section1);
public abstract @NotNull IntentionAction createMoveCatchUpFix(@NotNull PsiCatchSection section, @NotNull PsiCatchSection section1);
@NotNull
public abstract IntentionAction createRenameWrongRefFix(@NotNull PsiReferenceExpression ref);
public abstract @NotNull IntentionAction createRenameWrongRefFix(@NotNull PsiReferenceExpression ref);
@NotNull
public abstract IntentionAction createRemoveQualifierFix(@NotNull PsiExpression qualifier,
@NotNull PsiReferenceExpression expression,
@NotNull PsiClass resolved);
public abstract @NotNull IntentionAction createRemoveQualifierFix(@NotNull PsiExpression qualifier,
@NotNull PsiReferenceExpression expression,
@NotNull PsiClass resolved);
@NotNull
public abstract IntentionAction createRemoveParameterListFix(@NotNull PsiMethod parent);
public abstract @NotNull IntentionAction createRemoveParameterListFix(@NotNull PsiMethod parent);
@NotNull
public abstract IntentionAction createShowModulePropertiesFix(@NotNull PsiElement element);
public abstract @NotNull IntentionAction createShowModulePropertiesFix(@NotNull PsiElement element);
@NotNull
public abstract IntentionAction createShowModulePropertiesFix(@NotNull Module module);
public abstract @NotNull IntentionAction createShowModulePropertiesFix(@NotNull Module module);
@NotNull
public abstract IntentionAction createIncreaseLanguageLevelFix(@NotNull LanguageLevel level);
public abstract @NotNull IntentionAction createIncreaseLanguageLevelFix(@NotNull LanguageLevel level);
@NotNull
public abstract IntentionAction createUpgradeSdkFor(@NotNull LanguageLevel level);
public abstract @NotNull IntentionAction createUpgradeSdkFor(@NotNull LanguageLevel level);
@NotNull
public abstract IntentionAction createChangeParameterClassFix(@NotNull PsiClass aClass, @NotNull PsiClassType type);
public abstract @NotNull IntentionAction createChangeParameterClassFix(@NotNull PsiClass aClass, @NotNull PsiClassType type);
@NotNull
public abstract IntentionAction createReplaceInaccessibleFieldWithGetterSetterFix(@NotNull PsiReferenceExpression element,
@NotNull PsiMethod getter,
boolean isSetter);
public abstract @NotNull IntentionAction createReplaceInaccessibleFieldWithGetterSetterFix(@NotNull PsiReferenceExpression element,
@NotNull PsiMethod getter,
boolean isSetter);
@NotNull
public abstract IntentionAction createSurroundWithArrayFix(@Nullable PsiCall methodCall, @Nullable PsiExpression expression);
public abstract @NotNull IntentionAction createSurroundWithArrayFix(@Nullable PsiCall methodCall, @Nullable PsiExpression expression);
@NotNull
public abstract IntentionAction createImplementAbstractClassMethodsFix(@NotNull PsiElement elementToHighlight);
public abstract @NotNull IntentionAction createImplementAbstractClassMethodsFix(@NotNull PsiElement elementToHighlight);
@NotNull
public abstract IntentionAction createMoveClassToSeparateFileFix(@NotNull PsiClass aClass);
public abstract @NotNull IntentionAction createMoveClassToSeparateFileFix(@NotNull PsiClass aClass);
@NotNull
public abstract IntentionAction createRenameFileFix(@NotNull String newName);
public abstract @NotNull IntentionAction createRenameFileFix(@NotNull String newName);
@Nullable
public abstract IntentionAction createRenameFix(@NotNull PsiElement element);
public abstract @Nullable IntentionAction createRenameFix(@NotNull PsiElement element);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createRenameElementFix(@NotNull PsiNamedElement element);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createRenameElementFix(@NotNull PsiNamedElement element);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createRenameElementFix(@NotNull PsiNamedElement element,
@NotNull String newName);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createRenameElementFix(@NotNull PsiNamedElement element,
@NotNull String newName);
@NotNull
public abstract IntentionAction createChangeExtendsToImplementsFix(@NotNull PsiClass aClass, @NotNull PsiClassType classToExtendFrom);
public abstract @NotNull IntentionAction createChangeExtendsToImplementsFix(@NotNull PsiClass aClass, @NotNull PsiClassType classToExtendFrom);
@NotNull
public abstract IntentionAction createCreateConstructorMatchingSuperFix(@NotNull PsiClass aClass);
public abstract @NotNull IntentionAction createCreateConstructorMatchingSuperFix(@NotNull PsiClass aClass);
@NotNull
public abstract IntentionAction createRemoveNewQualifierFix(@NotNull PsiNewExpression expression, @Nullable PsiClass aClass);
public abstract @NotNull IntentionAction createRemoveNewQualifierFix(@NotNull PsiNewExpression expression, @Nullable PsiClass aClass);
@NotNull
public abstract IntentionAction createSuperMethodReturnFix(@NotNull PsiMethod superMethod, @NotNull PsiType superMethodType);
public abstract @NotNull IntentionAction createSuperMethodReturnFix(@NotNull PsiMethod superMethod, @NotNull PsiType superMethodType);
@NotNull
public abstract IntentionAction createInsertNewFix(@NotNull PsiMethodCallExpression call, @NotNull PsiClass aClass);
public abstract @NotNull IntentionAction createInsertNewFix(@NotNull PsiMethodCallExpression call, @NotNull PsiClass aClass);
@NotNull
public abstract IntentionAction createAddMethodBodyFix(@NotNull PsiMethod method);
public abstract @NotNull IntentionAction createAddMethodBodyFix(@NotNull PsiMethod method);
@NotNull
public abstract IntentionAction createAddMethodBodyFix(@NotNull PsiMethod method, @NotNull @Nls String text);
public abstract @NotNull IntentionAction createAddMethodBodyFix(@NotNull PsiMethod method, @NotNull @Nls String text);
@NotNull
public abstract IntentionAction createDeleteMethodBodyFix(@NotNull PsiMethod method);
public abstract @NotNull IntentionAction createDeleteMethodBodyFix(@NotNull PsiMethod method);
@NotNull
public abstract IntentionAction createInsertSuperFix(@NotNull PsiMethod constructor);
public abstract @NotNull IntentionAction createInsertSuperFix(@NotNull PsiMethod constructor);
@NotNull
public abstract IntentionAction createInsertThisFix(@NotNull PsiMethod constructor);
public abstract @NotNull IntentionAction createInsertThisFix(@NotNull PsiMethod constructor);
@NotNull
public abstract IntentionAction createChangeMethodSignatureFromUsageFix(@NotNull PsiMethod targetMethod,
PsiExpression @NotNull [] expressions,
@NotNull PsiSubstitutor substitutor,
@NotNull PsiElement context,
boolean changeAllUsages, int minUsagesNumberToShowDialog);
public abstract @NotNull IntentionAction createChangeMethodSignatureFromUsageFix(@NotNull PsiMethod targetMethod,
PsiExpression @NotNull [] expressions,
@NotNull PsiSubstitutor substitutor,
@NotNull PsiElement context,
boolean changeAllUsages, int minUsagesNumberToShowDialog);
@NotNull
public abstract IntentionAction createChangeMethodSignatureFromUsageReverseOrderFix(@NotNull PsiMethod targetMethod,
PsiExpression @NotNull [] expressions,
@NotNull PsiSubstitutor substitutor,
@NotNull PsiElement context,
boolean changeAllUsages,
int minUsagesNumberToShowDialog);
public abstract @NotNull IntentionAction createChangeMethodSignatureFromUsageReverseOrderFix(@NotNull PsiMethod targetMethod,
PsiExpression @NotNull [] expressions,
@NotNull PsiSubstitutor substitutor,
@NotNull PsiElement context,
boolean changeAllUsages,
int minUsagesNumberToShowDialog);
@NotNull
public List<IntentionAction> createCreateMethodFromUsageFixes(@NotNull PsiMethodCallExpression call) {
public @NotNull List<IntentionAction> createCreateMethodFromUsageFixes(@NotNull PsiMethodCallExpression call) {
return Collections.emptyList();
}
@NotNull
public abstract IntentionAction createCreateMethodFromUsageFix(@NotNull PsiMethodReferenceExpression methodReferenceExpression);
public abstract @NotNull IntentionAction createCreateMethodFromUsageFix(@NotNull PsiMethodReferenceExpression methodReferenceExpression);
@NotNull
public List<IntentionAction> createCreateConstructorFromCallExpressionFixes(@NotNull PsiMethodCallExpression call) {
public @NotNull List<IntentionAction> createCreateConstructorFromCallExpressionFixes(@NotNull PsiMethodCallExpression call) {
return Collections.emptyList();
}
@NotNull
public abstract IntentionAction createReplaceWithTypePatternFix(@NotNull PsiReferenceExpression exprToReplace,
@NotNull PsiClass resolvedExprClass,
@NotNull String patternVarName);
public abstract @NotNull IntentionAction createReplaceWithTypePatternFix(@NotNull PsiReferenceExpression exprToReplace,
@NotNull PsiClass resolvedExprClass,
@NotNull String patternVarName);
@NotNull
public abstract IntentionAction createStaticImportMethodFix(@NotNull PsiMethodCallExpression call);
public abstract @NotNull IntentionAction createStaticImportMethodFix(@NotNull PsiMethodCallExpression call);
@NotNull
public abstract IntentionAction createQualifyStaticMethodCallFix(@NotNull PsiMethodCallExpression call);
public abstract @NotNull IntentionAction createQualifyStaticMethodCallFix(@NotNull PsiMethodCallExpression call);
@NotNull
public abstract IntentionAction createReplaceAddAllArrayToCollectionFix(@NotNull PsiMethodCallExpression call);
public abstract @NotNull IntentionAction createReplaceAddAllArrayToCollectionFix(@NotNull PsiMethodCallExpression call);
@NotNull
public List<IntentionAction> createCreateConstructorFromUsageFixes(@NotNull PsiConstructorCall call) {
public @NotNull List<IntentionAction> createCreateConstructorFromUsageFixes(@NotNull PsiConstructorCall call) {
return Collections.emptyList();
}
@NotNull
public abstract List<IntentionAction> getVariableTypeFromCallFixes(@NotNull PsiMethodCallExpression call,
@NotNull PsiExpressionList list);
public abstract @NotNull List<IntentionAction> getVariableTypeFromCallFixes(@NotNull PsiMethodCallExpression call,
@NotNull PsiExpressionList list);
@NotNull
public abstract IntentionAction createAddReturnFix(@NotNull PsiParameterListOwner methodOrLambda);
public abstract @NotNull IntentionAction createAddReturnFix(@NotNull PsiParameterListOwner methodOrLambda);
@NotNull
public abstract IntentionAction createAddVariableInitializerFix(@NotNull PsiVariable variable);
public abstract @NotNull IntentionAction createAddVariableInitializerFix(@NotNull PsiVariable variable);
@NotNull
public abstract IntentionAction createDeferFinalAssignmentFix(@NotNull PsiVariable variable, @NotNull PsiReferenceExpression expression);
public abstract @NotNull IntentionAction createDeferFinalAssignmentFix(@NotNull PsiVariable variable, @NotNull PsiReferenceExpression expression);
@NotNull
public abstract IntentionAction createVariableAccessFromInnerClassFix(@NotNull PsiVariable variable, @NotNull PsiElement scope);
public abstract @NotNull IntentionAction createVariableAccessFromInnerClassFix(@NotNull PsiVariable variable, @NotNull PsiElement scope);
@NotNull
public abstract IntentionAction createCreateConstructorParameterFromFieldFix(@NotNull PsiField field);
public abstract @NotNull IntentionAction createCreateConstructorParameterFromFieldFix(@NotNull PsiField field);
@NotNull
public abstract IntentionAction createInitializeFinalFieldInConstructorFix(@NotNull PsiField field);
public abstract @NotNull IntentionAction createInitializeFinalFieldInConstructorFix(@NotNull PsiField field);
@NotNull
public abstract IntentionAction createChangeClassSignatureFromUsageFix(@NotNull PsiClass owner,
@NotNull PsiReferenceParameterList parameterList);
public abstract @NotNull IntentionAction createChangeClassSignatureFromUsageFix(@NotNull PsiClass owner,
@NotNull PsiReferenceParameterList parameterList);
@NotNull
public abstract IntentionAction createReplacePrimitiveWithBoxedTypeAction(@NotNull PsiTypeElement element,
@NotNull String typeName,
@NotNull String boxedTypeName);
public abstract @NotNull IntentionAction createReplacePrimitiveWithBoxedTypeAction(@NotNull PsiTypeElement element,
@NotNull String typeName,
@NotNull String boxedTypeName);
@Nullable
public abstract IntentionAction createReplacePrimitiveWithBoxedTypeAction(@NotNull PsiType operandType,
@NotNull PsiTypeElement checkTypeElement);
public abstract @Nullable IntentionAction createReplacePrimitiveWithBoxedTypeAction(@NotNull PsiType operandType,
@NotNull PsiTypeElement checkTypeElement);
@NotNull
public abstract IntentionAction createMakeVarargParameterLastFix(@NotNull PsiVariable parameter);
public abstract @NotNull IntentionAction createMakeVarargParameterLastFix(@NotNull PsiVariable parameter);
@NotNull
public abstract IntentionAction createMakeReceiverParameterFirstFix(@NotNull PsiReceiverParameter parameter);
public abstract @NotNull IntentionAction createMakeReceiverParameterFirstFix(@NotNull PsiReceiverParameter parameter);
@NotNull
public abstract IntentionAction createMoveBoundClassToFrontFix(@NotNull PsiTypeParameter aClass, @NotNull PsiClassType type);
public abstract @NotNull IntentionAction createMoveBoundClassToFrontFix(@NotNull PsiTypeParameter aClass, @NotNull PsiClassType type);
public abstract void registerPullAsAbstractUpFixes(@NotNull PsiMethod method, @NotNull List<? super IntentionAction> registrar);
@NotNull
public abstract IntentionAction createCreateAnnotationMethodFromUsageFix(@NotNull PsiNameValuePair pair);
public abstract @NotNull IntentionAction createCreateAnnotationMethodFromUsageFix(@NotNull PsiNameValuePair pair);
@NotNull
public abstract IntentionAction createOptimizeImportsFix(boolean onTheFly, @NotNull PsiFile file);
public abstract @NotNull IntentionAction createOptimizeImportsFix(boolean onTheFly, @NotNull PsiFile file);
@NotNull
public abstract IntentionAction createSafeDeleteUnusedParameterInHierarchyFix(@NotNull PsiParameter parameter, boolean excludingHierarchy);
public abstract @NotNull IntentionAction createSafeDeleteUnusedParameterInHierarchyFix(@NotNull PsiParameter parameter, boolean excludingHierarchy);
@NotNull
public abstract IntentionAction createAddToDependencyInjectionAnnotationsFix(@NotNull Project project, @NotNull String qualifiedName);
public abstract @NotNull IntentionAction createAddToDependencyInjectionAnnotationsFix(@NotNull Project project, @NotNull String qualifiedName);
@NotNull
public abstract IntentionAction createAddToImplicitlyWrittenFieldsFix(@NotNull Project project, @NotNull String qualifiedName);
public abstract @NotNull IntentionAction createAddToImplicitlyWrittenFieldsFix(@NotNull Project project, @NotNull String qualifiedName);
@NotNull
public abstract IntentionAction createCreateGetterOrSetterFix(boolean createGetter, boolean createSetter, @NotNull PsiField field);
public abstract @NotNull IntentionAction createCreateGetterOrSetterFix(boolean createGetter, boolean createSetter, @NotNull PsiField field);
@NotNull
public abstract IntentionAction createRenameToIgnoredFix(@NotNull PsiVariable namedElement, boolean useElementNameAsSuffix);
public abstract @NotNull IntentionAction createRenameToIgnoredFix(@NotNull PsiVariable namedElement, boolean useElementNameAsSuffix);
@NotNull
public abstract IntentionAction createEnableOptimizeImportsOnTheFlyFix();
public abstract @NotNull IntentionAction createEnableOptimizeImportsOnTheFlyFix();
@NotNull
public abstract IntentionAction createDeleteFix(@NotNull PsiElement @NotNull ... elements);
public abstract @NotNull IntentionAction createDeleteFix(@NotNull PsiElement @NotNull ... elements);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createDeleteFix(@NotNull PsiElement element);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createDeleteFix(@NotNull PsiElement element);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createDeleteFix(@NotNull PsiElement element, @NotNull @Nls String text);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createDeleteFix(@NotNull PsiElement element, @NotNull @Nls String text);
@NotNull
public abstract IntentionAction createDeleteSideEffectAwareFix(@NotNull PsiExpressionStatement statement);
public abstract @NotNull IntentionAction createDeleteSideEffectAwareFix(@NotNull PsiExpressionStatement statement);
@NotNull
public abstract IntentionAction createSafeDeleteFix(@NotNull PsiElement element);
public abstract @NotNull IntentionAction createSafeDeleteFix(@NotNull PsiElement element);
/**
* @param method method to delete
@@ -411,112 +312,81 @@ public abstract class QuickFixFactory {
public abstract @NotNull List<@NotNull LocalQuickFix> registerOrderEntryFixes(@NotNull PsiReference reference,
@NotNull List<? super IntentionAction> registrar);
@NotNull
public abstract IntentionAction createAddMissingRequiredAnnotationParametersFix(@NotNull PsiAnnotation annotation,
PsiMethod @NotNull [] annotationMethods,
@NotNull Collection<String> missedElements);
public abstract @NotNull IntentionAction createAddMissingRequiredAnnotationParametersFix(@NotNull PsiAnnotation annotation,
PsiMethod @NotNull [] annotationMethods,
@NotNull Collection<String> missedElements);
@NotNull
public abstract IntentionAction createSurroundWithQuotesAnnotationParameterValueFix(@NotNull PsiAnnotationMemberValue value,
@NotNull PsiType expectedType);
public abstract @NotNull IntentionAction createSurroundWithQuotesAnnotationParameterValueFix(@NotNull PsiAnnotationMemberValue value,
@NotNull PsiType expectedType);
@NotNull
public abstract IntentionAction addMethodQualifierFix(@NotNull PsiMethodCallExpression methodCall);
public abstract @NotNull IntentionAction addMethodQualifierFix(@NotNull PsiMethodCallExpression methodCall);
@NotNull
public abstract IntentionAction createWrapWithOptionalFix(@Nullable PsiType type, @NotNull PsiExpression expression);
public abstract @NotNull IntentionAction createWrapWithOptionalFix(@Nullable PsiType type, @NotNull PsiExpression expression);
@Nullable
public abstract IntentionAction createNotIterableForEachLoopFix(@NotNull PsiExpression expression);
public abstract @Nullable IntentionAction createNotIterableForEachLoopFix(@NotNull PsiExpression expression);
@NotNull
@Unmodifiable
public abstract List<IntentionAction> createAddAnnotationAttributeNameFixes(@NotNull PsiNameValuePair pair);
public abstract @NotNull @Unmodifiable List<IntentionAction> createAddAnnotationAttributeNameFixes(@NotNull PsiNameValuePair pair);
@NotNull
public abstract IntentionAction createCollectionToArrayFix(@NotNull PsiExpression collectionExpression,
@NotNull PsiExpression expressionToReplace,
@NotNull PsiArrayType arrayType);
public abstract @NotNull IntentionAction createCollectionToArrayFix(@NotNull PsiExpression collectionExpression,
@NotNull PsiExpression expressionToReplace,
@NotNull PsiArrayType arrayType);
@NotNull
public abstract IntentionAction createInsertMethodCallFix(@NotNull PsiMethodCallExpression call, @NotNull PsiMethod method);
public abstract @NotNull IntentionAction createInsertMethodCallFix(@NotNull PsiMethodCallExpression call, @NotNull PsiMethod method);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAccessStaticViaInstanceFix(@NotNull PsiReferenceExpression methodRef,
@NotNull JavaResolveResult result);
public abstract @NotNull LocalQuickFixAndIntentionActionOnPsiElement createAccessStaticViaInstanceFix(@NotNull PsiReferenceExpression methodRef,
@NotNull JavaResolveResult result);
@NotNull
public abstract IntentionAction createWrapWithAdapterFix(@Nullable PsiType type, @NotNull PsiExpression expression);
public abstract @NotNull IntentionAction createWrapWithAdapterFix(@Nullable PsiType type, @NotNull PsiExpression expression);
@Nullable
public abstract IntentionAction createCreateClassInPackageInModuleFix(@NotNull Module module, @Nullable String packageName);
public abstract @Nullable IntentionAction createCreateClassInPackageInModuleFix(@NotNull Module module, @Nullable String packageName);
@NotNull
public abstract IntentionAction createPushDownMethodFix();
public abstract @NotNull IntentionAction createPushDownMethodFix();
@NotNull
public abstract IntentionAction createSameErasureButDifferentMethodsFix(@NotNull PsiMethod method, @NotNull PsiMethod superMethod);
public abstract @NotNull IntentionAction createSameErasureButDifferentMethodsFix(@NotNull PsiMethod method, @NotNull PsiMethod superMethod);
@NotNull
public abstract IntentionAction createAddMissingEnumBranchesFix(@NotNull PsiSwitchBlock switchBlock, @NotNull Set<String> missingCases);
public abstract @NotNull IntentionAction createAddMissingEnumBranchesFix(@NotNull PsiSwitchBlock switchBlock, @NotNull Set<String> missingCases);
@NotNull
public abstract IntentionAction createAddMissingSealedClassBranchesFix(@NotNull PsiSwitchBlock switchBlock,
@NotNull @Unmodifiable Set<String> missingCases,
@NotNull List<String> allNames);
public abstract @NotNull IntentionAction createAddMissingSealedClassBranchesFix(@NotNull PsiSwitchBlock switchBlock,
@NotNull @Unmodifiable Set<String> missingCases,
@NotNull List<String> allNames);
@Nullable
public abstract IntentionAction createAddMissingRecordClassBranchesFix(@NotNull PsiSwitchBlock switchBlock,
@NotNull PsiClass selectorType,
@NotNull Map<PsiType, Set<List<PsiType>>> branches,
@NotNull List<? extends PsiCaseLabelElement> elements);
public abstract @Nullable IntentionAction createAddMissingRecordClassBranchesFix(@NotNull PsiSwitchBlock switchBlock,
@NotNull PsiClass selectorType,
@NotNull Map<PsiType, Set<List<PsiType>>> branches,
@NotNull List<? extends PsiCaseLabelElement> elements);
@Nullable
public abstract IntentionAction createAddMissingSealedClassBranchesFixWithNull(@NotNull PsiSwitchBlock switchBlock,
public abstract @Nullable IntentionAction createAddMissingSealedClassBranchesFixWithNull(@NotNull PsiSwitchBlock switchBlock,
@NotNull Set<String> missingCases,
@NotNull List<String> allNames);
@Nullable
public abstract IntentionAction createAddMissingBooleanPrimitiveBranchesFix(@NotNull PsiSwitchBlock block);
public abstract @Nullable IntentionAction createAddMissingBooleanPrimitiveBranchesFix(@NotNull PsiSwitchBlock block);
@Nullable
public abstract IntentionAction createAddMissingBooleanPrimitiveBranchesFixWithNull(@NotNull PsiSwitchBlock block);
public abstract @Nullable IntentionAction createAddMissingBooleanPrimitiveBranchesFixWithNull(@NotNull PsiSwitchBlock block);
@NotNull
public abstract IntentionAction createAddSwitchDefaultFix(@NotNull PsiSwitchBlock switchBlock, @Nullable String message);
public abstract @NotNull IntentionAction createAddSwitchDefaultFix(@NotNull PsiSwitchBlock switchBlock, @Nullable String message);
@Nullable
public abstract IntentionAction createCollapseAnnotationsFix(@NotNull PsiAnnotation annotation);
public abstract @Nullable IntentionAction createCollapseAnnotationsFix(@NotNull PsiAnnotation annotation);
@NotNull
public abstract IntentionAction createChangeModifierFix();
public abstract @NotNull IntentionAction createChangeModifierFix();
@NotNull
public abstract IntentionAction createWrapSwitchRuleStatementsIntoBlockFix(@NotNull PsiSwitchLabeledRuleStatement rule);
public abstract @NotNull IntentionAction createWrapSwitchRuleStatementsIntoBlockFix(@NotNull PsiSwitchLabeledRuleStatement rule);
@NotNull
public abstract IntentionAction createAddParameterListFix(@NotNull PsiMethod method);
public abstract @NotNull IntentionAction createAddParameterListFix(@NotNull PsiMethod method);
@NotNull
public abstract IntentionAction createAddEmptyRecordHeaderFix(@NotNull PsiClass record);
public abstract @NotNull IntentionAction createAddEmptyRecordHeaderFix(@NotNull PsiClass record);
@NotNull
public abstract IntentionAction createCreateFieldFromParameterFix(@NotNull PsiParameter parameter);
@NotNull
public abstract IntentionAction createAssignFieldFromParameterFix(@NotNull PsiParameter parameter);
public abstract @NotNull IntentionAction createCreateFieldFromParameterFix(@NotNull PsiParameter parameter);
public abstract @NotNull IntentionAction createAssignFieldFromParameterFix(@NotNull PsiParameter parameter);
@NotNull
public abstract IntentionAction createFillPermitsListFix(@NotNull PsiIdentifier classIdentifier);
public abstract @NotNull IntentionAction createFillPermitsListFix(@NotNull PsiIdentifier classIdentifier);
/**
* @param subClass class that should be added to the parent permits list
* @param superClass sealed parent class from subclasses' extends / implements clause
*/
@NotNull
public abstract IntentionAction createAddToPermitsListFix(@NotNull PsiClass subClass, @NotNull PsiClass superClass);
public abstract @NotNull IntentionAction createAddToPermitsListFix(@NotNull PsiClass subClass, @NotNull PsiClass superClass);
@NotNull
public abstract IntentionAction createMoveClassToPackageFix(@NotNull PsiClass classToMove, @NotNull String packageName);
public abstract @NotNull IntentionAction createMoveClassToPackageFix(@NotNull PsiClass classToMove, @NotNull String packageName);
/**
* Provides fixes to make class extend sealed class and
@@ -550,8 +420,7 @@ public abstract class QuickFixFactory {
public abstract @NotNull IntentionAction createConvertInterfaceToClassFix(@NotNull PsiClass aClass);
@Nullable
public abstract IntentionAction createUnwrapArrayInitializerMemberValueAction(@NotNull PsiArrayInitializerMemberValue arrayValue);
public abstract @Nullable IntentionAction createUnwrapArrayInitializerMemberValueAction(@NotNull PsiArrayInitializerMemberValue arrayValue);
public abstract @NotNull IntentionAction createIntroduceVariableAction(@NotNull PsiExpression expression);
@@ -565,15 +434,12 @@ public abstract class QuickFixFactory {
public abstract @NotNull IntentionAction createAddAnnotationTargetFix(@NotNull PsiAnnotation annotation, PsiAnnotation.TargetType target);
@Nullable
public abstract IntentionAction createMergeDuplicateAttributesFix(@NotNull PsiNameValuePair pair);
public abstract @Nullable IntentionAction createMergeDuplicateAttributesFix(@NotNull PsiNameValuePair pair);
@NotNull
public abstract IntentionAction createMoveSwitchBranchUpFix(@NotNull PsiCaseLabelElement moveBeforeLabel,
@NotNull PsiCaseLabelElement labelElement);
public abstract @NotNull IntentionAction createMoveSwitchBranchUpFix(@NotNull PsiCaseLabelElement moveBeforeLabel,
@NotNull PsiCaseLabelElement labelElement);
@NotNull
public abstract IntentionAction createSimplifyBooleanFix(@NotNull PsiExpression expression, boolean value);
public abstract @NotNull IntentionAction createSimplifyBooleanFix(@NotNull PsiExpression expression, boolean value);
/**
* Creates a fix that sets explicit variable type
@@ -635,17 +501,13 @@ public abstract class QuickFixFactory {
* @param text the text to show in the intention popup
* @return a fix that deletes the elements
*/
@NotNull
public abstract IntentionAction createDeleteFix(@NotNull PsiElement @NotNull [] elements, @NotNull @Nls String text);
public abstract @NotNull IntentionAction createDeleteFix(@NotNull PsiElement @NotNull [] elements, @NotNull @Nls String text);
@NotNull
public abstract ModCommandAction createReplaceCaseDefaultWithDefaultFix(@NotNull PsiCaseLabelElementList list);
public abstract @NotNull ModCommandAction createReplaceCaseDefaultWithDefaultFix(@NotNull PsiCaseLabelElementList list);
@NotNull
public abstract ModCommandAction createReverseCaseDefaultNullFixFix(@NotNull PsiCaseLabelElementList list);
public abstract @NotNull ModCommandAction createReverseCaseDefaultNullFixFix(@NotNull PsiCaseLabelElementList list);
@ApiStatus.Experimental
@NotNull
public abstract IntentionAction createAddMainMethodFix(@NotNull PsiImplicitClass implicitClass);
public abstract @NotNull IntentionAction createAddMainMethodFix(@NotNull PsiImplicitClass implicitClass);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection;
import com.intellij.java.analysis.JavaAnalysisBundle;
@@ -88,8 +88,7 @@ public abstract class AbstractBaseJavaLocalInspectionTool extends LocalInspectio
}
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) {
return new JavaElementVisitor() {
@Override
public void visitMethod(@NotNull PsiMethod method) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2017 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.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection;
import com.intellij.openapi.util.Condition;
@@ -65,8 +65,7 @@ public abstract class AbstractBaseUastLocalInspectionTool extends LocalInspectio
}
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) {
return UastHintedVisitorAdapter.create(holder.getFile().getLanguage(), new AbstractUastNonRecursiveVisitor() {
@Override
public boolean visitClass(@NotNull UClass node) {
@@ -103,7 +102,7 @@ public abstract class AbstractBaseUastLocalInspectionTool extends LocalInspectio
}
@Override
public PsiNamedElement getProblemElement(@NotNull final PsiElement psiElement) {
public PsiNamedElement getProblemElement(final @NotNull PsiElement psiElement) {
return (PsiNamedElement)PsiTreeUtil.findFirstParent(psiElement, PROBLEM_ELEMENT_CONDITION);
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection;
@@ -21,9 +7,9 @@ import org.jetbrains.annotations.NotNull;
public abstract class GlobalJavaBatchInspectionTool extends GlobalInspectionTool {
@Override
public boolean queryExternalUsagesRequests(@NotNull final InspectionManager manager,
@NotNull final GlobalInspectionContext globalContext,
@NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) {
public boolean queryExternalUsagesRequests(final @NotNull InspectionManager manager,
final @NotNull GlobalInspectionContext globalContext,
final @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
return queryExternalUsagesRequests(globalContext.getRefManager(), globalContext.getExtension(GlobalJavaInspectionContext.CONTEXT), problemDescriptionsProcessor);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 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.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection;
@@ -77,9 +77,8 @@ public abstract class GlobalJavaInspectionContext implements GlobalInspectionCon
public abstract EntryPointsManager getEntryPointsManager(RefManager manager);
@NotNull
@Override
public Key<GlobalJavaInspectionContext> getID() {
public @NotNull Key<GlobalJavaInspectionContext> getID() {
return CONTEXT;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.reference;
import com.intellij.psi.PsiClass;
@@ -30,8 +30,7 @@ public interface RefClass extends RefJavaElement, RefOverridable {
List<RefMethod> getConstructors();
/** @return the fields of this class */
@Unmodifiable
default List<RefField> getFields() {
default @Unmodifiable List<RefField> getFields() {
return Collections.emptyList();
}
@@ -39,8 +38,7 @@ public interface RefClass extends RefJavaElement, RefOverridable {
Set<RefElement> getInTypeReferences();
@Deprecated(forRemoval = true)
@NotNull
default Set<RefElement> getInstanceReferences() {
default @NotNull Set<RefElement> getInstanceReferences() {
throw new UnsupportedOperationException();
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.reference;
import org.jetbrains.annotations.NotNull;
@@ -23,9 +9,8 @@ import org.jetbrains.annotations.NotNull;
* @author anna
*/
public interface RefImplicitConstructor extends RefMethod {
@NotNull
@Override
default RefClass getOwnerClass() {
default @NotNull RefClass getOwnerClass() {
throw new UnsupportedOperationException();
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.reference;
import com.intellij.codeInspection.ex.EntryPointsManager;
@@ -19,13 +19,13 @@ import java.util.Collections;
import java.util.List;
public abstract class RefJavaManager implements RefManagerExtension<RefJavaManager> {
@NonNls public static final String CLASS = "class";
@NonNls public static final String METHOD = "method";
@NonNls static final String IMPLICIT_CONSTRUCTOR = "implicit.constructor";
@NonNls public static final String FIELD = "field";
@NonNls static final String PARAMETER = "parameter";
@NonNls static final String JAVA_MODULE = "java.module";
@NonNls public static final String PACKAGE = "package";
public static final @NonNls String CLASS = "class";
public static final @NonNls String METHOD = "method";
static final @NonNls String IMPLICIT_CONSTRUCTOR = "implicit.constructor";
public static final @NonNls String FIELD = "field";
static final @NonNls String PARAMETER = "parameter";
static final @NonNls String JAVA_MODULE = "java.module";
public static final @NonNls String PACKAGE = "package";
static final String FUNCTIONAL_EXPRESSION = "functional.expression";
public static final Key<RefJavaManager> MANAGER = Key.create("RefJavaManager");
private final List<Language> myLanguages;
@@ -76,15 +76,13 @@ public abstract class RefJavaManager implements RefManagerExtension<RefJavaManag
public abstract EntryPointsManager getEntryPointsManager();
@NotNull
@Override
public Collection<Language> getLanguages() {
public @NotNull Collection<Language> getLanguages() {
return myLanguages;
}
@NotNull
@Override
public Key<RefJavaManager> getID() {
public @NotNull Key<RefJavaManager> getID() {
return MANAGER;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.reference;
@@ -31,27 +31,22 @@ public abstract class RefJavaUtil {
* @param refEntity the entity to get the package name for.
* @return the package name, or null if the specified entity is not contained in a package.
*/
@Nullable
public abstract String getPackageName(RefEntity refEntity);
public abstract @Nullable String getPackageName(RefEntity refEntity);
@Nullable
public RefClass getOwnerClass(RefManager refManager, UElement uElement) {
public @Nullable RefClass getOwnerClass(RefManager refManager, UElement uElement) {
throw new UnsupportedOperationException();
}
@Deprecated(forRemoval = true)
@Nullable
public RefClass getOwnerClass(RefManager refManager, PsiElement psiElement) {
public @Nullable RefClass getOwnerClass(RefManager refManager, PsiElement psiElement) {
throw new UnsupportedOperationException();
}
@Nullable
public abstract RefClass getOwnerClass(RefElement refElement);
public abstract @Nullable RefClass getOwnerClass(RefElement refElement);
public abstract int compareAccess(String a1, String a2);
@NotNull
public abstract String getAccessModifier(@NotNull PsiModifierListOwner modifiersOwner);
public abstract @NotNull String getAccessModifier(@NotNull PsiModifierListOwner modifiersOwner);
public abstract void setAccessModifier(@NotNull RefJavaElement refElement, @NotNull String newAccess);
@@ -68,8 +63,7 @@ public abstract class RefJavaUtil {
throw new UnsupportedOperationException();
}
@Nullable
public static RefPackage getPackage(RefEntity refEntity) {
public static @Nullable RefPackage getPackage(RefEntity refEntity) {
while (refEntity != null && !(refEntity instanceof RefPackage)) {
if (refEntity instanceof RefElement) {
((RefElement)refEntity).initializeIfNeeded();

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.reference;
import com.intellij.codeInspection.GlobalInspectionTool;
@@ -167,10 +167,8 @@ public interface RefMethod extends RefJavaElement, RefOverridable {
throw new UnsupportedOperationException();
}
@NotNull
@Override
@Unmodifiable
default Collection<? extends RefOverridable> getDerivedReferences() {
default @NotNull @Unmodifiable Collection<? extends RefOverridable> getDerivedReferences() {
return getDerivedMethods();
}

View File

@@ -42,8 +42,7 @@ public interface RefParameter extends RefJavaElement {
* @deprecated Use {@link RefParameter#getActualConstValue()) instead
*/
@Deprecated(forRemoval = true)
@Nullable
default String getActualValueIfSame() {
default @Nullable String getActualValueIfSame() {
throw new UnsupportedOperationException();
}
@@ -55,8 +54,7 @@ public interface RefParameter extends RefJavaElement {
*
* @return the parameter value or null if it's different or impossible to determine.
*/
@Nullable
default Object getActualConstValue() {
default @Nullable Object getActualConstValue() {
//noinspection deprecation
return getActualValueIfSame();
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 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.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.jvm.actions;
import org.jetbrains.annotations.NotNull;
@@ -11,8 +11,7 @@ public interface AnnotationRequest extends ActionRequest {
@NotNull
String getQualifiedName();
@NotNull
default List<AnnotationAttributeRequest> getAttributes() {
default @NotNull List<AnnotationAttributeRequest> getAttributes() {
return Collections.emptyList();
}

View File

@@ -1,4 +1,4 @@
// 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.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.jvm.actions;
import com.intellij.lang.jvm.JvmParameter;
@@ -28,27 +28,22 @@ public interface ChangeParametersRequest extends ActionRequest {
myExistingParameter = existingParameter;
}
@NotNull
@Override
public List<ExpectedType> getExpectedTypes() {
public @NotNull List<ExpectedType> getExpectedTypes() {
return Collections.singletonList(new SimpleExpectedType(myExistingParameter.getType(), ExpectedType.Kind.EXACT));
}
@NotNull
@Override
public Collection<String> getSemanticNames() {
public @NotNull Collection<String> getSemanticNames() {
return Collections.singletonList(myExistingParameter.getName());
}
@NotNull
public JvmParameter getExistingParameter() {
public @NotNull JvmParameter getExistingParameter() {
return myExistingParameter;
}
@NotNull
@Override
@Unmodifiable
public Collection<AnnotationRequest> getExpectedAnnotations() {
public @NotNull @Unmodifiable Collection<AnnotationRequest> getExpectedAnnotations() {
return ContainerUtil.mapNotNull(myExistingParameter.getAnnotations(), AnnotationRequestsKt::annotationRequest);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 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.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.jvm.actions;
import org.jetbrains.annotations.NotNull;
@@ -18,14 +18,11 @@ public interface ExpectedParameter {
* which then will be used to suggest parameter names
* taking code style parameter prefix into consideration as well as its type.
*/
@NotNull
default Collection<String> getSemanticNames() {
default @NotNull Collection<String> getSemanticNames() {
return Collections.emptyList();
}
@NotNull
@Unmodifiable
default Collection<AnnotationRequest> getExpectedAnnotations() {
default @NotNull @Unmodifiable Collection<AnnotationRequest> getExpectedAnnotations() {
return Collections.emptyList();
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 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.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.jvm.actions;
import com.intellij.codeInsight.intention.IntentionAction;
@@ -34,9 +34,7 @@ public interface JvmGroupIntentionAction extends IntentionAction {
* <p>
* This method is accessed only if {@link #isAvailable} returned {@code true}.
*/
@Nls(capitalization = Nls.Capitalization.Sentence)
@NotNull
default String getGroupDisplayText() {
default @Nls(capitalization = Nls.Capitalization.Sentence) @NotNull String getGroupDisplayText() {
return getActionGroup().getDisplayText(getRenderData());
}
@@ -47,8 +45,7 @@ public interface JvmGroupIntentionAction extends IntentionAction {
* <p>
* This method is accessed only if {@link #isAvailable} returned {@code true}.
*/
@Nullable
default JvmActionGroup.RenderData getRenderData() {
default @Nullable JvmActionGroup.RenderData getRenderData() {
return null;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.module;
import com.intellij.pom.java.LanguageLevel;
@@ -9,8 +9,7 @@ public final class EffectiveLanguageLevelUtil {
* @deprecated use {@link LanguageLevelUtil#getEffectiveLanguageLevel(Module)} directly instead
*/
@Deprecated
@NotNull
public static LanguageLevel getEffectiveLanguageLevel(@NotNull final Module module) {
public static @NotNull LanguageLevel getEffectiveLanguageLevel(final @NotNull Module module) {
return LanguageLevelUtil.getEffectiveLanguageLevel(module);
}
}

View File

@@ -39,8 +39,7 @@ public final class LanguageLevelUtil {
* May return {@linkplain LanguageLevel#isUnsupported() unsupported} language level.
* @param module to get the language level for.
*/
@NotNull
public static LanguageLevel getEffectiveLanguageLevel(@NotNull final Module module) {
public static @NotNull LanguageLevel getEffectiveLanguageLevel(final @NotNull Module module) {
ApplicationManager.getApplication().assertReadAccessAllowed();
LanguageLevel level = getCustomLanguageLevel(module);
if (level != null) return level;
@@ -84,8 +83,7 @@ public final class LanguageLevelUtil {
* @param languageLevel The language level for which to retrieve the short name.
* @return The short name associated with the specified language level, or null if the language level is not released yet.
*/
@Nullable
public static String getShortMessage(@NotNull LanguageLevel languageLevel) {
public static @Nullable String getShortMessage(@NotNull LanguageLevel languageLevel) {
return ourPresentableShortMessage.get(languageLevel);
}
@@ -93,8 +91,7 @@ public final class LanguageLevelUtil {
* For performance reasons, the forbidden API is pre-generated.
* @see com.intellij.jvm.analysis.internal.testFramework.JavaApiUsageGenerator
*/
@Nullable
private static Set<String> getForbiddenApi(@NotNull LanguageLevel languageLevel) {
private static @Nullable Set<String> getForbiddenApi(@NotNull LanguageLevel languageLevel) {
String message = getShortMessage(languageLevel);
if (message == null) return null;
Reference<Set<String>> ref = ourForbiddenAPI.get(languageLevel);
@@ -170,8 +167,7 @@ public final class LanguageLevelUtil {
/**
* For serialization of forbidden api.
*/
@Nullable
public static String getSignature(@Nullable PsiMember member) {
public static @Nullable String getSignature(@Nullable PsiMember member) {
if (member instanceof PsiClass) {
return ((PsiClass)member).getQualifiedName();
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.roots;
import com.intellij.openapi.projectRoots.Sdk;
@@ -11,8 +11,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
public final class JdkUtils {
@Nullable
public static Sdk getJdkForElement(@NotNull PsiElement element) {
public static @Nullable Sdk getJdkForElement(@NotNull PsiElement element) {
final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
if (virtualFile == null) return null;
final List<OrderEntry> entries = ProjectRootManager.getInstance(element.getProject()).getFileIndex().getOrderEntriesForFile(virtualFile);