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:
anna
2012-10-08 19:22:03 +02:00
parent 2363877462
commit 7cdf305e1c
2 changed files with 3 additions and 2 deletions
@@ -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;
@@ -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