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 /taskdefs/src/test | |
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 'taskdefs/src/test')
-rw-r--r-- | taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java b/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java index b1f7c7b4f..4b387c21b 100644 --- a/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java +++ b/taskdefs/src/test/java/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java @@ -178,7 +178,7 @@ public class AjcTaskTest extends TestCase { String m = e.getMessage(); if (null == m) { assertTrue("not " + exceptionString, false); - } else if (-1 == m.indexOf(exceptionString)) { + } else if (!m.contains(exceptionString)) { assertEquals(exceptionString, e.getMessage()); } } @@ -218,7 +218,7 @@ public class AjcTaskTest extends TestCase { if (NOFILE.equals(input)) { // add nothing } else if (input.endsWith(".lst")) { - if (-1 != input.indexOf(",")) { + if (input.contains(",")) { throw new IllegalArgumentException( "lists not supported: " + input); } else if (null == testdataDir) { @@ -695,7 +695,7 @@ public class AjcTaskTest extends TestCase { } assertTrue( "expecting aspectj in classpath", - (-1 != classpath.indexOf("aspectjrt.jar"))); + (classpath.contains("aspectjrt.jar"))); } CompilerArg createCompilerArg(String value) { @@ -792,7 +792,7 @@ public class AjcTaskTest extends TestCase { boolean matched = false; for (int i = 0; !matched && (i < results.length); i++) { String s = results[i]; - matched = (null != s) && (-1 != s.indexOf(DEFAULT)); + matched = (null != s) && (s.contains(DEFAULT)); } if (!matched) { fail(DEFAULT + " not found in " + Arrays.asList(results)); |