From ce35eff448f9fdf5f4e3e17ac0b16761f4e2a747 Mon Sep 17 00:00:00 2001
From: Rostislav Krasny <45571812+rosti-il@users.noreply.github.com>
Date: Wed, 22 Jan 2020 20:50:14 +0200
Subject: [PATCH] [MNG-6853] - Don't box primitives where it's not needed
Closes #318
---
.../artifact/repository/ArtifactRepositoryPolicy.java | 4 ++--
.../main/java/org/apache/maven/project/ModelUtils.java | 8 ++++----
.../inheritance/DefaultModelInheritanceAssembler.java | 4 ++--
.../main/java/org/apache/maven/cli/CLIReportingUtils.java | 2 +-
.../src/main/java/org/apache/maven/cli/MavenCli.java | 4 ++--
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java
index 5a795e9205..5ce317f205 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java
@@ -138,7 +138,7 @@ public class ArtifactRepositoryPolicy
else if ( updatePolicy.startsWith( UPDATE_POLICY_INTERVAL ) )
{
String s = updatePolicy.substring( UPDATE_POLICY_INTERVAL.length() + 1 );
- int minutes = Integer.valueOf( s );
+ int minutes = Integer.parseInt( s );
Calendar cal = Calendar.getInstance();
cal.add( Calendar.MINUTE, -minutes );
if ( cal.getTime().after( lastModified ) )
@@ -212,7 +212,7 @@ public class ArtifactRepositoryPolicy
else if ( policy != null && policy.startsWith( ArtifactRepositoryPolicy.UPDATE_POLICY_INTERVAL ) )
{
String s = policy.substring( UPDATE_POLICY_INTERVAL.length() + 1 );
- return Integer.valueOf( s );
+ return Integer.parseInt( s );
}
else
{
diff --git a/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java b/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java
index 9bcc384234..a428da03f9 100644
--- a/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java
+++ b/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java
@@ -76,7 +76,7 @@ public final class ModelUtils
String inherited = plugin.getInherited();
- if ( ( inherited != null ) && !Boolean.valueOf( inherited ) )
+ if ( ( inherited != null ) && !Boolean.parseBoolean( inherited ) )
{
it.remove();
}
@@ -97,7 +97,7 @@ public final class ModelUtils
// 2. the parent's flag is not set
// 3. the parent's flag is set to true
if ( !handleAsInheritance || ( parentInherited == null )
- || Boolean.valueOf( parentInherited ) )
+ || Boolean.parseBoolean( parentInherited ) )
{
Plugin childPlugin = childPlugins.get( parentPlugin.getKey() );
@@ -217,7 +217,7 @@ public final class ModelUtils
// from here to the end of the method is dealing with merging of the section.
String parentInherited = parent.getInherited();
- boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited );
+ boolean parentIsInherited = ( parentInherited == null ) || Boolean.parseBoolean( parentInherited );
List parentExecutions = parent.getExecutions();
@@ -234,7 +234,7 @@ public final class ModelUtils
String inherited = parentExecution.getInherited();
boolean parentExecInherited =
- parentIsInherited && ( ( inherited == null ) || Boolean.valueOf( inherited ) );
+ parentIsInherited && ( ( inherited == null ) || Boolean.parseBoolean( inherited ) );
if ( !handleAsInheritance || parentExecInherited )
{
diff --git a/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java b/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
index f21b99bb2f..0113562cff 100644
--- a/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
+++ b/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
@@ -382,7 +382,7 @@ public class DefaultModelInheritanceAssembler
{
String parentInherited = parentPlugin.getInherited();
- if ( !handleAsInheritance || ( parentInherited == null ) || Boolean.valueOf( parentInherited ) )
+ if ( !handleAsInheritance || ( parentInherited == null ) || Boolean.parseBoolean( parentInherited ) )
{
ReportPlugin assembledPlugin = parentPlugin;
@@ -470,7 +470,7 @@ public class DefaultModelInheritanceAssembler
// from here to the end of the method is dealing with merging of the section.
String parentInherited = parent.getInherited();
- boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited );
+ boolean parentIsInherited = ( parentInherited == null ) || Boolean.parseBoolean( parentInherited );
List parentReportSets = parent.getReportSets();
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
index d562c88221..97a2db65bd 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
@@ -96,7 +96,7 @@ public final class CLIReportingUtils
msg += ( rev != null ? rev : "" );
if ( StringUtils.isNotBlank( timestamp ) )
{
- String ts = formatTimestamp( Long.valueOf( timestamp ) );
+ String ts = formatTimestamp( Long.parseLong( timestamp ) );
msg += ( rev != null ? "; " : "" ) + ts;
}
msg += ")";
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 7af20bef3e..5ca060206c 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -1613,7 +1613,7 @@ public class MavenCli
}
else
{
- request.setDegreeOfConcurrency( Integer.valueOf( threadConfiguration ) );
+ request.setDegreeOfConcurrency( Integer.parseInt( threadConfiguration ) );
}
}
@@ -1631,7 +1631,7 @@ public class MavenCli
int calculateDegreeOfConcurrencyWithCoreMultiplier( String threadConfiguration )
{
int procs = Runtime.getRuntime().availableProcessors();
- return (int) ( Float.valueOf( threadConfiguration.replace( "C", "" ) ) * procs );
+ return (int) ( Float.parseFloat( threadConfiguration.replace( "C", "" ) ) * procs );
}
// ----------------------------------------------------------------------