mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-intentions] Do not suggest to insert 'return' in the void method
GitOrigin-RevId: e73ca4a07b093b819858fb165d4b6207e9fcd360
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1ac30a6fc9
commit
ee20b97285
+5
-13
@@ -431,22 +431,14 @@ public final class HighlightFixUtil {
|
||||
PsiType type = expression.getType();
|
||||
if (type == null) return;
|
||||
if (!type.equals(PsiTypes.voidType())) {
|
||||
IntentionAction action = PriorityIntentionActionWrapper.highPriority(QUICK_FIX_FACTORY.createIterateFix(expression));
|
||||
registrar.add(action);
|
||||
}
|
||||
if (PsiTreeUtil.skipWhitespacesAndCommentsForward(statement) == block.getRBrace()) {
|
||||
PsiElement blockParent = block.getParent();
|
||||
if (blockParent instanceof PsiMethod) {
|
||||
PsiType returnType = ((PsiMethod)blockParent).getReturnType();
|
||||
registrar.add(PriorityIntentionActionWrapper.highPriority(QUICK_FIX_FACTORY.createIterateFix(expression)));
|
||||
if (PsiTreeUtil.skipWhitespacesAndCommentsForward(statement) == block.getRBrace() && block.getParent() instanceof PsiMethod method) {
|
||||
PsiType returnType = method.getReturnType();
|
||||
if (returnType != null && isPossibleReturnValue(expression, type, returnType)) {
|
||||
IntentionAction action = QUICK_FIX_FACTORY.createInsertReturnFix(expression);
|
||||
registrar.add(action);
|
||||
registrar.add(QUICK_FIX_FACTORY.createInsertReturnFix(expression));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!type.equals(PsiTypes.voidType())) {
|
||||
IntentionAction action = QUICK_FIX_FACTORY.createIntroduceVariableAction(expression);
|
||||
registrar.add(action);
|
||||
registrar.add(QUICK_FIX_FACTORY.createIntroduceVariableAction(expression));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Insert 'return'" "false"
|
||||
class X {
|
||||
void test() {
|
||||
test()<caret>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user