mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
method refs: disable suggestions to change/migrate type of variable if right type is method reference - no way to suggest correct type now (IDEA-92600)
This commit is contained in:
@@ -481,7 +481,7 @@ public class HighlightUtil {
|
||||
int start = variable.getTypeElement().getTextRange().getStartOffset();
|
||||
int end = variable.getTextRange().getEndOffset();
|
||||
HighlightInfo highlightInfo = checkAssignability(lType, rType, initializer, new TextRange(start, end));
|
||||
if (highlightInfo != null && !(rType instanceof PsiMethodReferenceType)) {
|
||||
if (highlightInfo != null) {
|
||||
registerChangeVariableTypeFixes(variable, rType, highlightInfo);
|
||||
}
|
||||
return highlightInfo;
|
||||
@@ -2534,6 +2534,7 @@ public class HighlightUtil {
|
||||
}
|
||||
|
||||
public static void registerChangeVariableTypeFixes(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);
|
||||
|
||||
+2
-1
@@ -272,7 +272,7 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool
|
||||
if (initializer == null || initializer instanceof PsiArrayInitializerExpression) return;
|
||||
final PsiType initializerType = initializer.getType();
|
||||
checkRawToGenericsAssignment(initializer, variable.getType(), initializerType, true,
|
||||
myOnTheFly && !(initializerType instanceof PsiMethodReferenceType) ? getChangeVariableTypeFixes(variable, initializerType) : LocalQuickFix.EMPTY_ARRAY);
|
||||
myOnTheFly ? getChangeVariableTypeFixes(variable, initializerType) : LocalQuickFix.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -467,6 +467,7 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool
|
||||
}
|
||||
|
||||
public static LocalQuickFix[] getChangeVariableTypeFixes(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)) {
|
||||
|
||||
Reference in New Issue
Block a user