mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -2603,11 +2603,13 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
return info;
|
||||
}
|
||||
|
||||
public static void registerChangeVariableTypeFixes(PsiVariable parameter, PsiType itemType, HighlightInfo highlightInfo) {
|
||||
public static void registerChangeVariableTypeFixes(@NotNull PsiVariable parameter, PsiType itemType, HighlightInfo highlightInfo) {
|
||||
if (itemType instanceof PsiMethodReferenceType) return;
|
||||
for (ChangeVariableTypeQuickFixProvider fixProvider : Extensions.getExtensions(ChangeVariableTypeQuickFixProvider.EP_NAME)) {
|
||||
for (IntentionAction action : fixProvider.getFixes(parameter, itemType)) {
|
||||
QuickFixAction.registerQuickFixAction(highlightInfo, action);
|
||||
if (itemType != null) {
|
||||
for (ChangeVariableTypeQuickFixProvider fixProvider : Extensions.getExtensions(ChangeVariableTypeQuickFixProvider.EP_NAME)) {
|
||||
for (IntentionAction action : fixProvider.getFixes(parameter, itemType)) {
|
||||
QuickFixAction.registerQuickFixAction(highlightInfo, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
ChangeParameterClassFix.registerQuickFixAction(parameter.getType(), itemType, highlightInfo);
|
||||
|
||||
+3
-1
@@ -24,10 +24,12 @@ import com.intellij.codeInsight.quickfix.ChangeVariableTypeQuickFixProvider;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.psi.PsiVariable;
|
||||
import com.intellij.psi.PsiType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class VariableTypeQuickFixProvider implements ChangeVariableTypeQuickFixProvider{
|
||||
@NotNull
|
||||
@Override
|
||||
public IntentionAction[] getFixes(PsiVariable variable, PsiType toReturn) {
|
||||
public IntentionAction[] getFixes(@NotNull PsiVariable variable, @NotNull PsiType toReturn) {
|
||||
return new IntentionAction[]{new VariableTypeFix(variable, toReturn)};
|
||||
}
|
||||
}
|
||||
+7
-5
@@ -473,14 +473,16 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool
|
||||
}
|
||||
}
|
||||
|
||||
public static LocalQuickFix[] getChangeVariableTypeFixes(PsiVariable parameter, PsiType itemType) {
|
||||
public static LocalQuickFix[] getChangeVariableTypeFixes(@NotNull PsiVariable parameter, PsiType itemType) {
|
||||
if (itemType instanceof PsiMethodReferenceType) return LocalQuickFix.EMPTY_ARRAY;
|
||||
final List<LocalQuickFix> result = new ArrayList<LocalQuickFix>();
|
||||
LOG.assertTrue(parameter.isValid());
|
||||
for (ChangeVariableTypeQuickFixProvider fixProvider : Extensions.getExtensions(ChangeVariableTypeQuickFixProvider.EP_NAME)) {
|
||||
for (IntentionAction action : fixProvider.getFixes(parameter, itemType)) {
|
||||
if (action instanceof LocalQuickFix) {
|
||||
result.add((LocalQuickFix)action);
|
||||
if (itemType != null) {
|
||||
for (ChangeVariableTypeQuickFixProvider fixProvider : Extensions.getExtensions(ChangeVariableTypeQuickFixProvider.EP_NAME)) {
|
||||
for (IntentionAction action : fixProvider.getFixes(parameter, itemType)) {
|
||||
if (action instanceof LocalQuickFix) {
|
||||
result.add((LocalQuickFix)action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -24,9 +24,11 @@ import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.PsiVariable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ChangeVariableTypeQuickFixProvider {
|
||||
ExtensionPointName<ChangeVariableTypeQuickFixProvider> EP_NAME = ExtensionPointName.create("com.intellij.codeInsight.changeVariableTypeQuickFixProvider");
|
||||
|
||||
IntentionAction[] getFixes(PsiVariable variable, PsiType toReturn);
|
||||
@NotNull
|
||||
IntentionAction[] getFixes(@NotNull PsiVariable variable, @NotNull PsiType toReturn);
|
||||
}
|
||||
Reference in New Issue
Block a user