diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java index 06b19406945e..174b2b4d9efb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java @@ -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); diff --git a/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java b/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java index 2eae3fffd3ed..db52ddebb2d8 100644 --- a/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java @@ -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 result = new ArrayList(); LOG.assertTrue(parameter.isValid()); for (ChangeVariableTypeQuickFixProvider fixProvider : Extensions.getExtensions(ChangeVariableTypeQuickFixProvider.EP_NAME)) {