mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Recursive call markers temporary turned off
This commit is contained in:
@@ -32,7 +32,6 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.searches.AllOverridingMethodsSearch;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
@@ -61,8 +60,6 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
|
||||
private static final Icon IMPLEMENTED_INTERFACE_MARKER_RENDERER = IMPLEMENTED_METHOD_MARKER_RENDERER;
|
||||
private static final Icon SUBCLASSED_CLASS_MARKER_RENDERER = OVERRIDEN_METHOD_MARKER_RENDERER;
|
||||
|
||||
private static final Icon RECURSIVE_METHOD_ICON = IconLoader.getIcon("/gutter/recursiveMethod.png");
|
||||
|
||||
protected final DaemonCodeAnalyzerSettings myDaemonSettings;
|
||||
protected final EditorColorsManager myColorsManager;
|
||||
|
||||
@@ -167,11 +164,6 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
|
||||
}
|
||||
else if (element instanceof PsiClass && !(element instanceof PsiTypeParameter)) {
|
||||
collectInheritingClasses((PsiClass)element, result);
|
||||
} else if(element instanceof PsiMethodCallExpression){
|
||||
final PsiMethodCallExpression methodCall = (PsiMethodCallExpression)element;
|
||||
if (isRecursiveMethodCall(methodCall)){
|
||||
result.add(new RecursiveMethodCallMarkerInfo(methodCall));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!methods.isEmpty()) {
|
||||
@@ -179,25 +171,6 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isRecursiveMethodCall(@NotNull PsiMethodCallExpression methodCall){
|
||||
final PsiMethod referencedMethod = methodCall.resolveMethod();
|
||||
|
||||
if (referencedMethod == null || !referencedMethod.isValid() || !methodCall.isValid()){
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiFile methodCallFile = methodCall.getContainingFile();
|
||||
final PsiFile methodFile = referencedMethod.getContainingFile();
|
||||
|
||||
if (methodCallFile == null || methodFile == null || !methodCallFile.equals(methodFile)){
|
||||
return false;
|
||||
}
|
||||
|
||||
final TextRange rmRange = referencedMethod.getTextRange();
|
||||
final int mcOffset = methodCall.getTextRange().getStartOffset();
|
||||
return rmRange != null && rmRange.contains(mcOffset);
|
||||
}
|
||||
|
||||
private static void collectInheritingClasses(PsiClass aClass, Collection<LineMarkerInfo> result) {
|
||||
if (aClass.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
return;
|
||||
@@ -303,36 +276,4 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static class RecursiveMethodCallMarkerInfo extends MergeableLineMarkerInfo<PsiMethodCallExpression> {
|
||||
private RecursiveMethodCallMarkerInfo(@NotNull PsiMethodCallExpression methodCall) {
|
||||
super(methodCall,
|
||||
methodCall.getTextRange(),
|
||||
RECURSIVE_METHOD_ICON,
|
||||
Pass.UPDATE_OVERRIDEN_MARKERS,
|
||||
FunctionUtil.<PsiMethodCallExpression, String>constant("Recursive call"),
|
||||
null,
|
||||
GutterIconRenderer.Alignment.RIGHT
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMergeWith(@NotNull MergeableLineMarkerInfo<?> info) {
|
||||
if (!(info instanceof RecursiveMethodCallMarkerInfo)) return false;
|
||||
PsiElement otherElement = info.getElement();
|
||||
PsiElement myElement = getElement();
|
||||
return otherElement != null && myElement != null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getCommonIcon(@NotNull List<MergeableLineMarkerInfo> infos) {
|
||||
return myIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Function<? super PsiElement, String> getCommonTooltip(@NotNull List<MergeableLineMarkerInfo> infos) {
|
||||
return FunctionUtil.<PsiElement, String>constant("Multiple recursive calls");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user