diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-08 03:11:12 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-08 03:11:12 +0200 |
commit | c1c373f4278426308689db61f7758185e8f0401b (patch) | |
tree | 9e03af2feb69782c50464fc1e1e2ce0d6b6bb8c5 /loadtime/src/main | |
parent | a508fd5315c6330f2057c219aebc35b15d0ea497 (diff) | |
download | aspectj-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 'loadtime/src/main')
-rw-r--r-- | loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | 2 | ||||
-rw-r--r-- | loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 173310591..5827f2e64 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -662,7 +662,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { * Checks if the pattern looks like "com.foo.Bar" - an exact name */ private String looksLikeExactName(String typePattern) { - if (hasSpaceAnnotationPlus(typePattern, 0) || typePattern.indexOf("*") != -1) { + if (hasSpaceAnnotationPlus(typePattern, 0) || typePattern.contains("*")) { return null; } return typePattern.replace('$', '.'); diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java index 6f5b58702..7f87e40c9 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java @@ -164,7 +164,7 @@ public class ConcreteAspectCodeGen { String parentAspectName = concreteAspect.extend; - if (parentAspectName.indexOf("<") != -1) { + if (parentAspectName.contains("<")) { // yikes, generic parent parent = world.resolve(UnresolvedType.forName(parentAspectName), true); if (parent.isMissing()) { @@ -741,7 +741,7 @@ public class ConcreteAspectCodeGen { return null; } String clazz = value.substring(0, value.length() - 6); - boolean qualified = clazz.indexOf(".") != -1; + boolean qualified = clazz.contains("."); if (!qualified) { // if not qualified, have to assume java.lang clazz = "java.lang." + clazz; |