diff options
Diffstat (limited to 'util')
5 files changed, 8 insertions, 8 deletions
diff --git a/util/src/main/java/org/aspectj/util/FileUtil.java b/util/src/main/java/org/aspectj/util/FileUtil.java index 6e55742b1..1927f47a0 100644 --- a/util/src/main/java/org/aspectj/util/FileUtil.java +++ b/util/src/main/java/org/aspectj/util/FileUtil.java @@ -1404,7 +1404,7 @@ public class FileUtil { /** @return true if input is not null and contains no path separator */ private static boolean isValidFileName(String input) { - return ((null != input) && (-1 == input.indexOf(File.pathSeparator))); + return ((null != input) && (!input.contains(File.pathSeparator))); } private static void listFiles(final File baseDir, String dir, ArrayList<String> result) { diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java index a0967cfcc..49a65df52 100644 --- a/util/src/main/java/org/aspectj/util/LangUtil.java +++ b/util/src/main/java/org/aspectj/util/LangUtil.java @@ -356,7 +356,7 @@ public class LangUtil { } ArrayList<String> result = new ArrayList<String>(); - if (LangUtil.isEmpty(delim) || (-1 == input.indexOf(delim))) { + if (LangUtil.isEmpty(delim) || (!input.contains(delim))) { result.add(input.trim()); } else { StringTokenizer st = new StringTokenizer(input, delim); @@ -1018,7 +1018,7 @@ public class LangUtil { boolean result = false; if (!LangUtil.isEmpty(input)) { for (int i = 0; !result && (i < infixes.length); i++) { - result = (-1 != input.indexOf(infixes[i])); + result = (input.contains(infixes[i])); } } return result; diff --git a/util/src/test/java/org/aspectj/util/FileUtilTest.java b/util/src/test/java/org/aspectj/util/FileUtilTest.java index 367c0ea5e..663352be6 100644 --- a/util/src/test/java/org/aspectj/util/FileUtilTest.java +++ b/util/src/test/java/org/aspectj/util/FileUtilTest.java @@ -162,7 +162,7 @@ public class FileUtilTest extends TestCase { * @param useSuffix if true, then use dir as suffix to path */ private static void doDirPaths(File dir, ArrayList<String> paths) { - if ((null == dir) || !dir.canRead() || (-1 != dir.getPath().indexOf("CVS"))) { + if ((null == dir) || !dir.canRead() || (dir.getPath().contains("CVS"))) { return; } File[] files = dir.listFiles(); diff --git a/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java b/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java index 73a272369..79cd0bbe9 100644 --- a/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java +++ b/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java @@ -189,7 +189,7 @@ public class GenericSignatureParserTest extends TestCase { GenericSignature.FieldTypeSignature cSig = parser.parseAsFieldSignature("Ljava/util/List</;"); fail("Expected IllegalStateException"); } catch (IllegalStateException ex) { - assertTrue(ex.getMessage().indexOf("Ljava/util/List</;") != -1); + assertTrue(ex.getMessage().contains("Ljava/util/List</;")); } } diff --git a/util/src/test/java/org/aspectj/util/LangUtilTest.java b/util/src/test/java/org/aspectj/util/LangUtilTest.java index 7e95858b9..545cdd904 100644 --- a/util/src/test/java/org/aspectj/util/LangUtilTest.java +++ b/util/src/test/java/org/aspectj/util/LangUtilTest.java @@ -229,7 +229,7 @@ public class LangUtilTest extends TestCase { LangUtil.elideEndingLines(LangUtil.StringChecker.TEST_PACKAGES, stackBuffer, 10); String result = stackBuffer.toString(); - if (-1 == result.indexOf("(... ")) { + if (!result.contains("(... ")) { // brittle - will fail under different top-level drivers String m = "when running under eclipse or Ant, expecting (... in trace: "; assertTrue(m + result, false); @@ -264,7 +264,7 @@ public class LangUtilTest extends TestCase { LangUtil.elideEndingLines(LangUtil.StringChecker.TEST_PACKAGES, stackBuffer, 25); result = stackBuffer.toString(); - assertTrue(result, -1 != result.indexOf("(... ")); - assertTrue(result, -1 == result.indexOf("org.aspectj.testing")); + assertTrue(result, result.contains("(... ")); + assertTrue(result, !result.contains("org.aspectj.testing")); } } |