mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
[java-inspections] RedundantStringOperation: suggest a more suitable quick-fix
IDEA-296617 GitOrigin-RevId: 03e7b3d6c733e8630e29a5867dc715daf5c1d2a9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bfc2636b4d
commit
8cebcabdc1
@@ -11,5 +11,6 @@ class X {
|
||||
if (s.startsWith("xyzt", 1)) { }
|
||||
if (s.endsWith("...")) {}
|
||||
if (s.endsWith(s2)) {}
|
||||
if (s.endsWith("xyzt")) {}
|
||||
}
|
||||
}
|
||||
@@ -11,5 +11,6 @@ class X {
|
||||
if (s.substring(1, 1+"xyzt".length()).equals("xyzt")) { }
|
||||
if (s.substring(s.length() - 3).equals("...")) {}
|
||||
if (s.substring(s.length() - s2.length()).equals(s2)) {}
|
||||
if (s.substring(s.length() - 4, s.length()).equals("xyzt")) {}
|
||||
}
|
||||
}
|
||||
@@ -313,10 +313,11 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
return createSubstringToCharAtProblemDescriptor(call);
|
||||
}
|
||||
}
|
||||
RemoveRedundantSubstringFix fix = new RemoveRedundantSubstringFix(isLengthOf(args[1], receiver) ? "endsWith" : "startsWith");
|
||||
return myManager.createProblemDescriptor(anchor, (TextRange)null,
|
||||
InspectionGadgetsBundle.message("inspection.redundant.string.call.message"),
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly,
|
||||
new RemoveRedundantSubstringFix("startsWith"));
|
||||
fix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user