From 7cdf305e1cd021d8c8477f6ede7fb9670788c1cc Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 8 Oct 2012 19:18:39 +0200 Subject: [PATCH] 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) --- .../codeInsight/daemon/impl/analysis/HighlightUtil.java | 2 +- .../uncheckedWarnings/UncheckedWarningLocalInspection.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 ab7ceea8dd20..06b19406945e 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) { + if (highlightInfo != null && !(rType instanceof PsiMethodReferenceType)) { registerChangeVariableTypeFixes(variable, rType, highlightInfo); } return highlightInfo; 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 8c77301bf660..2eae3fffd3ed 100644 --- a/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java @@ -271,7 +271,8 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool PsiExpression initializer = variable.getInitializer(); if (initializer == null || initializer instanceof PsiArrayInitializerExpression) return; final PsiType initializerType = initializer.getType(); - checkRawToGenericsAssignment(initializer, variable.getType(), initializerType, true, myOnTheFly ? getChangeVariableTypeFixes(variable, initializerType) : LocalQuickFix.EMPTY_ARRAY); + checkRawToGenericsAssignment(initializer, variable.getType(), initializerType, true, + myOnTheFly && !(initializerType instanceof PsiMethodReferenceType) ? getChangeVariableTypeFixes(variable, initializerType) : LocalQuickFix.EMPTY_ARRAY); } @Override