inline into method reference: keep with multiple return statements

This commit is contained in:
Anna Kozlova
2017-11-09 11:16:40 +01:00
parent 9d49a5ef51
commit 886eae4f67
3 changed files with 7 additions and 2 deletions

View File

@@ -311,7 +311,7 @@ public class InlineUtil {
public static TailCallType getTailCallType(@NotNull final PsiReference psiReference) {
PsiElement element = psiReference.getElement();
if (element instanceof PsiMethodReferenceExpression) return TailCallType.None;
if (element instanceof PsiMethodReferenceExpression) return TailCallType.Return;
PsiExpression methodCall = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class);
if (methodCall == null) return TailCallType.None;
PsiElement callParent = methodCall.getParent();

View File

@@ -6,6 +6,7 @@ class Test {
}
private String get() {
if (true) return null;
return null;
}
}

View File

@@ -2,10 +2,14 @@ import java.util.function.Supplier;
class Test {
{
Supplier<String> sup = () -> null;
Supplier<String> sup = () -> {
if (true) return null;
return null;
};
}
private String get() {
if (true) return null;
return null;
}
}