aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:11:12 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:11:12 +0200
commitc1c373f4278426308689db61f7758185e8f0401b (patch)
tree9e03af2feb69782c50464fc1e1e2ce0d6b6bb8c5 /asm
parenta508fd5315c6330f2057c219aebc35b15d0ea497 (diff)
downloadaspectj-c1c373f4278426308689db61f7758185e8f0401b.tar.gz
aspectj-c1c373f4278426308689db61f7758185e8f0401b.zip
'String.indexOf()' expression is replaceable with 'contains()'
Reports any String.indexOf() expressions which can be replaced with a call to the String.contains() method available in Java 5 and newer. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'asm')
-rw-r--r--asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java8
-rw-r--r--asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java2
2 files changed, 5 insertions, 5 deletions
diff --git a/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java b/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java
index 15eb990ee..5e518c51f 100644
--- a/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java
+++ b/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java
@@ -73,7 +73,7 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
if (folder.endsWith("/")) {
folder = folder.substring(0, folder.length() - 1);
}
- if (folder.indexOf("/") != -1) {
+ if (folder.contains("/")) {
folder = folder.replace("/", "\\/");
}
sb.append(folder);
@@ -211,7 +211,7 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
// this code needs a speed overhaul... and some proper tests
// Two static parts because one may be enclosing jpsp (269522)
if (sig1 != null) {
- if (sig1.indexOf("Lorg/aspectj/lang") != -1) {
+ if (sig1.contains("Lorg/aspectj/lang")) {
if (sig1.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
sig1 = sig1.substring(0, sig1.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
@@ -263,7 +263,7 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
// this code needs a speed overhaul... and some proper tests
// Two static parts because one may be enclosing jpsp (269522)
if (sig1 != null) {
- if (sig1.indexOf("Lorg/aspectj/lang") != -1) {
+ if (sig1.contains("Lorg/aspectj/lang")) {
if (sig1.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
sig1 = sig1.substring(0, sig1.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
@@ -358,7 +358,7 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
ipeSig = ipeSig.substring(0, idx);
}
if (ipeSig != null) {
- if (ipeSig.indexOf("Lorg/aspectj/lang") != -1) {
+ if (ipeSig.contains("Lorg/aspectj/lang")) {
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
diff --git a/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java b/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java
index c1479f70f..77fe7a66b 100644
--- a/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java
+++ b/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java
@@ -432,7 +432,7 @@ public class ProgramElement implements IProgramElement {
// check if someone is calling us with something that is a signature already
assert name.charAt(0) != '[';
- if (name.indexOf("<") == -1) {
+ if (!name.contains("<")) {
// not parameterized
return new StringBuilder("L").append(name.replace('.', '/')).append(';').toString();
} else {