diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java index a370186e7d48..871f077e312f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java @@ -135,7 +135,7 @@ public class MethodReturnTypeFix extends LocalQuickFixAndIntentionActionOnPsiEle } if (statementToSelect != null) { - Editor editorForMethod = getEditorForMethod(myMethod, project, editor, statementToSelect.getContainingFile()); + Editor editorForMethod = getEditorForMethod(myMethod, project, editor, file); if (editorForMethod != null) { selectReturnValueInEditor(statementToSelect, editorForMethod); } @@ -308,7 +308,9 @@ public class MethodReturnTypeFix extends LocalQuickFixAndIntentionActionOnPsiEle } static void selectReturnValueInEditor(final PsiReturnStatement returnStatement, final Editor editor) { - TextRange range = returnStatement.getReturnValue().getTextRange(); + final PsiExpression returnValue = returnStatement.getReturnValue(); + LOG.assertTrue(returnValue != null, returnStatement); + TextRange range = returnValue.getTextRange(); int offset = range.getStartOffset(); editor.getCaretModel().moveToOffset(offset); diff --git a/resources-en/src/messages/QuickFixBundle.properties b/resources-en/src/messages/QuickFixBundle.properties index 40230c94545f..9ec2d5c163d4 100644 --- a/resources-en/src/messages/QuickFixBundle.properties +++ b/resources-en/src/messages/QuickFixBundle.properties @@ -119,7 +119,7 @@ make.vararg.parameter.last.family=Make vararg parameter last make.vararg.parameter.last.text=Move ''{0}'' to the end of the list fix.parameter.type.family=Fix Parameter Type fix.parameter.type.text=Make ''{0}'' take parameter of type ''{1}'' here -fix.return.type.family=Fix Return Type +fix.return.type.family=Fix return type fix.return.type.text=Make ''{0}'' return ''{1}'' fix.throws.list.family=Fix Throws List fix.throws.list.add.exception=Add ''{0}'' to ''{1}'' throws list