Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2021-02-05 07:54:43 +0000
committerLars Vogel2021-02-12 09:32:26 +0000
commitfacba56b7d8518f2075087081fbe3b7e67f02494 (patch)
tree31e8603910c119e1b0f8845b25184f39157de2cb
parent4f0f856d19868f583a884849ae1f0fe05f87b909 (diff)
downloadeclipse.platform.text-facba56b7d8518f2075087081fbe3b7e67f02494.tar.gz
eclipse.platform.text-facba56b7d8518f2075087081fbe3b7e67f02494.tar.xz
eclipse.platform.text-facba56b7d8518f2075087081fbe3b7e67f02494.zip
[Cleanup] Redundant substring() operation
Removes the second substring() parameter if this parameter is the length of the string. It's the default value. Found during testing of Bug 569800 (new JDT cleanup for this case). Change-Id: Id3cc01ba81e2955044f199e8a3644b8ee17a01cc Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassImplementationsCodeMiningProvider.java2
-rw-r--r--org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassReferenceCodeMiningProvider.java2
-rw-r--r--org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java4
3 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassImplementationsCodeMiningProvider.java b/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassImplementationsCodeMiningProvider.java
index 1b450797c0d..e7a40233c6e 100644
--- a/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassImplementationsCodeMiningProvider.java
+++ b/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassImplementationsCodeMiningProvider.java
@@ -51,7 +51,7 @@ public class ClassImplementationsCodeMiningProvider extends AbstractCodeMiningPr
String line = AbstractClassCodeMining.getLineText(document, lineIndex).trim();
int index = line.indexOf(token);
if (index == 0) {
- String className = line.substring(index + token.length(), line.length());
+ String className = line.substring(index + token.length());
index = className.indexOf(" ");
if (index != -1) {
className = className.substring(0, index);
diff --git a/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassReferenceCodeMiningProvider.java b/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassReferenceCodeMiningProvider.java
index 2a168e95c86..4cf50f511ed 100644
--- a/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassReferenceCodeMiningProvider.java
+++ b/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/ClassReferenceCodeMiningProvider.java
@@ -43,7 +43,7 @@ public class ClassReferenceCodeMiningProvider extends AbstractCodeMiningProvider
String line = AbstractClassCodeMining.getLineText(document, i).trim();
int index = line.indexOf("class ");
if (index == 0) {
- String className = line.substring(index + "class ".length(), line.length()).trim();
+ String className = line.substring(index + "class ".length()).trim();
if (!className.isEmpty()) {
try {
lenses.add(new ClassReferenceCodeMining(className, i, document, this));
diff --git a/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java b/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java
index 3e37f642bb8..e6e07e52f16 100644
--- a/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java
+++ b/org.eclipse.jface.text.examples/src/org/eclipse/jface/text/examples/sources/inlined/InlinedAnnotationDemo.java
@@ -154,7 +154,7 @@ public class InlinedAnnotationDemo {
String line = getLineText(document, i).trim();
int index = line.indexOf("color:");
if (index == 0) {
- String rgb = line.substring(index + "color:".length(), line.length()).trim();
+ String rgb = line.substring(index + "color:".length()).trim();
try {
String status = "OK!";
Color color = parse(rgb, viewer.getTextWidget().getDisplay());
@@ -187,7 +187,7 @@ public class InlinedAnnotationDemo {
if (rgbIndex != -1) {
rgbIndex = rgbIndex + "rgb".length();
int startOffset = pos.offset + rgbIndex;
- String rgbContent = line.substring(rgbIndex, line.length());
+ String rgbContent = line.substring(rgbIndex);
int startIndex = addRGBParamNameAnnotation("red:", rgbContent, 0, startOffset, viewer, support,
annotations);
if (startIndex != -1) {

Back to the top