mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[java] show recursive call gutter for static qualified calls (IDEA-281605)
GitOrigin-RevId: ecc61fe42163a71c37a5fc7dade8578d99f289e3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0575beb759
commit
f383aebc60
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LineMarkerInfo;
|
||||
@@ -52,7 +52,8 @@ public class RecursiveCallLineMarkerProvider extends LineMarkerProviderDescripto
|
||||
|
||||
public static boolean isRecursiveMethodCall(@NotNull PsiMethodCallExpression methodCall) {
|
||||
final PsiExpression qualifier = methodCall.getMethodExpression().getQualifierExpression();
|
||||
if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
|
||||
if (qualifier != null && !(qualifier instanceof PsiThisExpression) &&
|
||||
!(qualifier instanceof PsiReferenceExpression && ((PsiReferenceExpression)qualifier).resolve() instanceof PsiClass)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class Recursion {
|
||||
private static void unrecognized (final int depth) {
|
||||
if (depth >= 0) {
|
||||
Recursion.unrecognized(depth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void recognized (final int depth) {
|
||||
if (depth >= 0) {
|
||||
recognized(depth - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.daemon;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.daemon.LineMarkerInfo;
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RecursiveCallLineMarkerTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/recursive";
|
||||
}
|
||||
|
||||
public void testQualifiedCall() {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.doHighlighting();
|
||||
final List<LineMarkerInfo<?>> infoList = DaemonCodeAnalyzerImpl.getLineMarkers(getEditor().getDocument(), getProject());
|
||||
|
||||
assertSize(2, infoList);
|
||||
for (LineMarkerInfo<?> info : infoList) {
|
||||
assertEquals(JavaBundle.message("tooltip.recursive.call"), info.getLineMarkerTooltip());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user