mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
IDEA-365975 Spring MVC: suggest to remove explicit path variable name if there's matching parameter
GitOrigin-RevId: 1ce9da79e81a8db1914dd9a2ccb00ca2bea48f84
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c355d7dcd7
commit
9c5f5b4cbf
+19
-1
@@ -20,7 +20,7 @@ public abstract class AbstractBaseUastLocalInspectionTool extends LocalInspectio
|
||||
private final Class<? extends UElement>[] myUElementsTypesHint;
|
||||
|
||||
protected AbstractBaseUastLocalInspectionTool() {
|
||||
this(UFile.class, UClass.class, UField.class, UMethod.class);
|
||||
this(UFile.class, UClass.class, UField.class, UMethod.class, UParameter.class);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@@ -64,6 +64,18 @@ public abstract class AbstractBaseUastLocalInspectionTool extends LocalInspectio
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this to report problems at parameter level.
|
||||
*
|
||||
* @param parameter to check.
|
||||
* @param manager InspectionManager to ask for ProblemDescriptors from.
|
||||
* @param isOnTheFly true if called during on the fly editor highlighting. Called from Inspect Code action otherwise.
|
||||
* @return {@code null} if no problems found or not applicable at parameter level.
|
||||
*/
|
||||
public ProblemDescriptor @Nullable [] checkParameter(@NotNull UParameter parameter, @NotNull InspectionManager manager, boolean isOnTheFly) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) {
|
||||
return UastHintedVisitorAdapter.create(holder.getFile().getLanguage(), new AbstractUastNonRecursiveVisitor() {
|
||||
@@ -91,6 +103,12 @@ public abstract class AbstractBaseUastLocalInspectionTool extends LocalInspectio
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visitParameter(@NotNull UParameter node) {
|
||||
addDescriptors(checkParameter(node, holder.getManager(), isOnTheFly));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addDescriptors(final ProblemDescriptor[] descriptors) {
|
||||
if (descriptors != null) {
|
||||
for (ProblemDescriptor descriptor : descriptors) {
|
||||
|
||||
Reference in New Issue
Block a user