From bfd6fee99d2685751a6d49eb29a0173c3f825c09 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Sat, 20 Nov 2021 20:37:02 +0300 Subject: Cleanup redundant boxing. Methods Integer.parseInt/Boolean.parseBoolean should be preferred over Integer.valueOf/Boolean.valueOf/ if final result is primitive. They are generally faster and generate less garbage. --- .../test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java | 2 +- .../test/java/org/aspectj/testing/harness/bridge/ParseTestCase.java | 4 ++-- testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java | 2 +- testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'testing') diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java index 0b9d6910e..5c2ec2ae3 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java @@ -267,7 +267,7 @@ public class FlatSuiteReader implements SFileReader.Maker { description.setLength(0); description.append((prefix + " " + suffix).trim()); try { - result.setBugId(Integer.valueOf(pr)); + result.setBugId(Integer.parseInt(pr)); } catch (NumberFormatException e) { throw new Error("unable to convert " + pr + " for " + result + " at " + lineReader); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/ParseTestCase.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/ParseTestCase.java index 85cdd38f1..e6f1ab918 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/ParseTestCase.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/ParseTestCase.java @@ -105,7 +105,7 @@ public class ParseTestCase extends TestCase { AjcTest.Spec test = new AjcTest.Spec(); test.setDescription(title); test.setTestDirOffset(dir); - test.setBugId(Integer.valueOf(pr)); + test.setBugId(Integer.parseInt(pr)); test.setSourceLocation(sourceLocation); //AjcTest test = new AjcTest(title, dir, pr, sourceLocation); @@ -174,7 +174,7 @@ public class ParseTestCase extends TestCase { file = new File("XXX"); //XXX } - int line = Integer.valueOf(getAttributeString(child, "line")); + int line = Integer.parseInt(getAttributeString(child, "line")); ISourceLocation sourceLocation = new SourceLocation(file, line, line, 0); diff --git a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java index a223a3453..be3541e4d 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java +++ b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java @@ -300,7 +300,7 @@ public class SoftMessage implements IMessage { if (null != sourceLocation) { throw new IllegalStateException("cannot set line after creating source location"); } - this.line = Integer.valueOf(line); + this.line = Integer.parseInt(line); SourceLocation.validLine(this.line); } diff --git a/testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java b/testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java index 305047d31..f0329d653 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java +++ b/testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java @@ -109,7 +109,7 @@ public class SoftSourceLocation implements ISourceLocation { } private int convert(String in) { - return Integer.valueOf(in); + return Integer.parseInt(in); } public String getLocationContext() { -- cgit v1.2.3