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 /testing-drivers/src | |
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 'testing-drivers/src')
-rw-r--r-- | testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java b/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java index e932a027d..6c0a84fe9 100644 --- a/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java +++ b/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java @@ -1056,7 +1056,7 @@ class SubstringRunner implements StringRunner { input = input.toLowerCase(); } for (String substring : substrings) { - if (-1 != input.indexOf(substring)) { + if (input.contains(substring)) { return true; } } @@ -1150,7 +1150,7 @@ class MessageRunValidator implements IRunValidator { continue; // hmm } String text = message.getMessage(); - if ((null != text) && (-1 != text.indexOf(sought))) { + if ((null != text) && (text.contains(sought))) { return true; } } |