diff options
Diffstat (limited to 'weaver')
10 files changed, 16 insertions, 16 deletions
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java index f49a1bb33..971ee314d 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java @@ -1958,7 +1958,7 @@ public class AtAjAttributes { Pointcut pointcut = parser.parsePointcut(); parser.checkEof(); pointcut.check(null, struct.enclosingType.getWorld()); - if (!allowIf && pointcutString.indexOf("if()") >= 0 && hasIf(pointcut)) { + if (!allowIf && pointcutString.contains("if()") && hasIf(pointcut)) { reportError("if() pointcut is not allowed at this pointcut location '" + pointcutString + "'", struct); return null; } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java index 1eae17682..60f366e5a 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -185,7 +185,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { // TAG: WeavingMessage if (changed && worthReporting && munger != null && !weaver.getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { String tName = weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getName(); - if (tName.indexOf("no debug info available") != -1) { + if (tName.contains("no debug info available")) { tName = "no debug info available"; } else { tName = getShortname(weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getPath()); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java index 1ee675655..5916e0117 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java @@ -230,7 +230,7 @@ public class BcelWorld extends World implements Repository { */ private String beautifyLocation(ISourceLocation isl) { StringBuffer nice = new StringBuffer(); - if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().indexOf("no debug info available") != -1) { + if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().contains("no debug info available")) { nice.append("no debug info available"); } else { // can't use File.getName() as this fails when a Linux box encounters a path created on Windows and vice-versa @@ -242,7 +242,7 @@ public class BcelWorld extends World implements Repository { if (binary != -1 && binary < takeFrom) { // we have been woven by a binary aspect String pathToBinaryLoc = isl.getSourceFile().getPath().substring(0, binary + 1); - if (pathToBinaryLoc.indexOf(".jar") != -1) { + if (pathToBinaryLoc.contains(".jar")) { // only want to add the extra info if we're from a jar file int lastSlash = pathToBinaryLoc.lastIndexOf('/'); if (lastSlash == -1) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java index 3480b8172..76bd4b84b 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java @@ -71,7 +71,7 @@ public abstract class ExtensibleURLClassLoader extends URLClassLoader { try { unresolvedType = UnresolvedType.forName(name); } catch (BCException bce) { - if (bce.getMessage().indexOf("nameToSignature") == -1) { + if (!bce.getMessage().contains("nameToSignature")) { bce.printStackTrace(System.err); } return null; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java index bb4a38817..c29721d4a 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java @@ -113,7 +113,7 @@ public class Utility { */ public static String beautifyLocation(ISourceLocation isl) { StringBuffer nice = new StringBuffer(); - if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().indexOf("no debug info available") != -1) { + if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().contains("no debug info available")) { nice.append("no debug info available"); } else { // can't use File.getName() as this fails when a Linux box diff --git a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java index 2e8a91291..7df7f438c 100644 --- a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java +++ b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java @@ -715,7 +715,7 @@ public class AsmRelationshipProvider { if (kind == ResolvedTypeMunger.Field) { // ITD FIELD // String name = rtMunger.getSignature().toString(); String name = sig.getDeclaringType().getClassName() + "." + sig.getName(); - if (name.indexOf("$") != -1) { + if (name.contains("$")) { name = name.substring(name.indexOf("$") + 1); } IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_FIELD, getBinarySourceLocation( @@ -725,7 +725,7 @@ public class AsmRelationshipProvider { } else if (kind == ResolvedTypeMunger.Method) { // ITD // METHOD String name = sig.getDeclaringType().getClassName() + "." + sig.getName(); - if (name.indexOf("$") != -1) { + if (name.contains("$")) { name = name.substring(name.indexOf("$") + 1); } IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_METHOD, getBinarySourceLocation( @@ -734,7 +734,7 @@ public class AsmRelationshipProvider { return pe; } else if (kind == ResolvedTypeMunger.Constructor) { String name = sig.getDeclaringType().getClassName() + "." + sig.getDeclaringType().getClassName(); - if (name.indexOf("$") != -1) { + if (name.contains("$")) { name = name.substring(name.indexOf("$") + 1); } IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR, diff --git a/weaver/src/test/java/org/aspectj/weaver/DumpTestCase.java b/weaver/src/test/java/org/aspectj/weaver/DumpTestCase.java index 752473533..ba78b686b 100644 --- a/weaver/src/test/java/org/aspectj/weaver/DumpTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/DumpTestCase.java @@ -122,7 +122,7 @@ public class DumpTestCase extends TestCase { String record; while ((null != (record = reader.readLine())) && (result == false)) { if (record.startsWith("----")) currentHeading = record; - else if ((record.indexOf(contents) != -1) && currentHeading.indexOf(heading) != -1) result = true; + else if ((record.contains(contents)) && currentHeading.contains(heading)) result = true; } reader.close(); } diff --git a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java index 6852da6b7..8e84a71e5 100644 --- a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java @@ -125,7 +125,7 @@ public class AnnotationPatternMatchingTestCase extends TestCase { String expected = "Type referred to is not an annotation type"; String msg = ((IMessage) mh.messages.get(0)).toString(); - assertTrue("Expected: " + expected + " but got " + msg, msg.indexOf(expected) != -1); + assertTrue("Expected: " + expected + " but got " + msg, msg.contains(expected)); } public void testReferenceViaFormalToNonAnnotationType() { @@ -142,7 +142,7 @@ public class AnnotationPatternMatchingTestCase extends TestCase { String expected = "Type referred to is not an annotation type"; String msg = ((IMessage) mh.messages.get(0)).toString(); - assertTrue("Expected: " + expected + " but got " + msg, msg.indexOf(expected) != -1); + assertTrue("Expected: " + expected + " but got " + msg, msg.contains(expected)); // expected = "Binding not supported in @pcds (1.5.0 M1 limitation): null"; // msg = ((IMessage)mh.messages.get(1)).toString(); diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java index ca9835c29..1ea33c465 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java @@ -47,7 +47,7 @@ public class PointcutDesignatorHandlerTest extends TestCase { .parsePointcutExpression("bean(service.*"); fail("should not be able to parse bean(service.*)"); } catch(IllegalArgumentException ex) { - assertTrue("contains bean",ex.getMessage().indexOf("bean") != -1); + assertTrue("contains bean", ex.getMessage().contains("bean")); } } diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java index 9488a5e90..fbf4d3068 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java @@ -336,14 +336,14 @@ public class PointcutParserTest extends TestCase { pc = parser.parsePointcutExpression("args(String)", null, new PointcutParameter[] { param }); fail("Expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) { - assertTrue("formal unbound", ex.getMessage().indexOf("formal unbound") != -1); + assertTrue("formal unbound", ex.getMessage().contains("formal unbound")); } try { pc = parser.parsePointcutExpression("args(y)"); fail("Expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) { - assertTrue("no match for type name", ex.getMessage().indexOf("warning no match for this type name: y") != -1); + assertTrue("no match for type name", ex.getMessage().contains("warning no match for this type name: y")); } } @@ -357,7 +357,7 @@ public class PointcutParserTest extends TestCase { try { p.parsePointcutExpression("this(FooBar)"); } catch (IllegalArgumentException ex) { - assertTrue("should have xlint:invalidAbsoluteTypeName", ex.getMessage().indexOf("Xlint:invalidAbsoluteTypeName") != -1); + assertTrue("should have xlint:invalidAbsoluteTypeName", ex.getMessage().contains("Xlint:invalidAbsoluteTypeName")); } Properties props = new Properties(); props.put("invalidAbsoluteTypeName", "ignore"); |