AIOOBE (IDEA-173816)

This commit is contained in:
Anna Kozlova
2017-06-05 17:45:45 +03:00
parent 071634d77e
commit 6b7f8028db
4 changed files with 18 additions and 1 deletions
@@ -130,7 +130,7 @@ public class ExtractToMethodReferenceIntention extends BaseElementAtCaretIntenti
targetMethodName + parameters, targetClass);
PsiCodeBlock targetMethodBody = emptyMethod.getBody();
LOG.assertTrue(targetMethodBody != null);
targetMethodBody.addRange(elements[0], elements[elements.length - 1]);
if (elements.length > 0) targetMethodBody.addRange(elements[0], elements[elements.length - 1]);
PsiMethod method = (PsiMethod)CodeStyleManager.getInstance(project).reformat(JavaCodeStyleManager.getInstance(project).shortenClassReferences(targetClass.add(emptyMethod)));
PsiMethodReferenceExpression methodReference =
@@ -0,0 +1,5 @@
class B {
{
Runnable r = () <caret>-> {} ;
}
}
@@ -0,0 +1,8 @@
class B {
{
Runnable r = B::run;
}
private static void run() {
}
}
@@ -54,6 +54,10 @@ public class ExtractToMethodReferenceTest extends IPPTestCase {
assertIntentionNotAvailable();
}
public void testEmptyCodeBlock() throws Exception {
doTest();
}
public void testUsedLocalVariables() throws Exception {
assertIntentionNotAvailable();
}