[maven] branch MNG-6837 updated (488a555 -> 6ab1bb7)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[maven] branch MNG-6837 updated (488a555 -> 6ab1bb7)

michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git.


 discard 488a555  [MNG-6837] Simplify detection of the MAVEN_HOME and make it fully qualified
    omit 6d63038  Revert "[MNG-5982] Pass user properties to ModelBuildingRequest"
    omit 5553ff0  [MNG-5982] Pass user properties to ModelBuildingRequest
    omit 08397c2  [MNG-6065] Moved org.slf4j.impl.MavenLoggerFactoryTest to the correct submodule
     new a46466e  [MNG-5982] Pass user properties to ModelBuildingRequest
     new cc863d8  Revert "[MNG-5982] Pass user properties to ModelBuildingRequest"
     new d86fda5  [MNG-6841] update plexus-interpolation to 1.26
     new 6017a94  [MNG-6844] Use StandardCharsets and remove outdated @SuppressWarnings
     new c1e0f88  [MNG-6842] ProjectBuilderTest uses Guava, but Guava is not defined in dependencies
     new b9b1c50  [MNG-6844] Remove outdated TODOs
     new b95c4fc  [MNG-6847] Explicit type can be replaced by the diamond operator
     new 6ab1bb7  [MNG-6837] Simplify detection of the MAVEN_HOME and make it fully qualified on Windows

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (488a555)
            \
             N -- N -- N   refs/heads/MNG-6837 (6ab1bb7)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 apache-maven/src/bin/mvn.cmd                         |  2 +-
 .../apache/maven/settings/GlobalSettingsTest.java    |  3 ++-
 .../resolver/MultipleArtifactsNotFoundException.java |  2 +-
 .../maven/artifact/versioning/VersionRange.java      |  4 ++--
 .../maven/building/DefaultProblemCollector.java      |  2 +-
 .../java/org/apache/maven/building/StringSource.java |  3 ++-
 .../artifact/resolver/DefaultArtifactResolver.java   |  2 +-
 .../DefaultModelInheritanceAssembler.java            |  6 ------
 .../artifact/AbstractArtifactComponentTestCase.java  |  3 ++-
 .../apache/maven/repository/legacy/StringWagon.java  | 10 ++--------
 .../org/apache/maven/DuplicateProjectException.java  |  2 +-
 .../DefaultMavenExecutionRequestPopulator.java       |  2 +-
 .../maven/execution/DefaultMavenExecutionResult.java |  4 ++--
 .../maven/graph/FilteredProjectDependencyGraph.java  |  2 +-
 .../DefaultLifecycleExecutionPlanCalculator.java     |  4 ++--
 .../maven/lifecycle/internal/DependencyContext.java  |  4 ++--
 .../lifecycle/internal/LifecycleModuleBuilder.java   |  3 +--
 .../maven/lifecycle/internal/ReactorBuildStatus.java |  2 +-
 .../builder/multithreaded/ThreadOutputMuxer.java     |  2 +-
 .../apache/maven/project/DefaultProjectBuilder.java  | 12 ++++++------
 .../java/org/apache/maven/project/MavenProject.java  |  2 +-
 .../project/artifact/DefaultMavenMetadataCache.java  |  8 ++++----
 .../maven/toolchain/DefaultToolchainManager.java     |  2 +-
 .../building/DefaultToolchainsBuildingResult.java    |  2 +-
 .../maven/artifact/handler/ArtifactHandlerTest.java  |  1 -
 .../maven/lifecycle/internal/BuilderCommonTest.java  |  2 +-
 .../internal/stub/CompletionServiceStub.java         |  2 +-
 .../internal/stub/DefaultLifecyclesStub.java         |  1 -
 .../lifecycle/internal/stub/MojoExecutorStub.java    |  2 +-
 .../project/ExtensionDescriptorBuilderTest.java      | 11 ++---------
 .../org/apache/maven/project/ProjectBuilderTest.java | 20 +++++++++++---------
 .../main/java/org/apache/maven/cli/CLIManager.java   |  2 +-
 .../cli/transfer/ConsoleMavenTransferListener.java   |  2 +-
 .../maven/model/building/DefaultModelBuilder.java    |  2 +-
 .../interpolation/ProblemDetectingValueSource.java   |  1 -
 .../internal/RemoteSnapshotMetadataTest.java         |  2 +-
 .../building/DefaultSettingsBuildingResult.java      |  2 +-
 .../building/DefaultSettingsProblemCollector.java    |  2 +-
 .../crypto/DefaultSettingsDecryptionResult.java      |  6 +++---
 pom.xml                                              |  2 +-
 40 files changed, 65 insertions(+), 83 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[maven] 01/08: [MNG-5982] Pass user properties to ModelBuildingRequest

michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git

commit a46466e1232e8812278a3d7c4e5f2171a83e1654
Author: Sylwester Lachiewicz <[hidden email]>
AuthorDate: Wed Jan 1 16:01:14 2020 +0100

    [MNG-5982] Pass user properties to ModelBuildingRequest
---
 .../maven/repository/internal/DefaultArtifactDescriptorReader.java       | 1 +
 1 file changed, 1 insertion(+)

diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
index 586c83e..5146ea7 100644
--- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
@@ -275,6 +275,7 @@ public class DefaultArtifactDescriptorReader
                 modelRequest.setTwoPhaseBuilding( false );
                 modelRequest.setSystemProperties( toProperties( session.getUserProperties(),
                                                                 session.getSystemProperties() ) );
+                modelRequest.setUserProperties( toProperties( session.getUserProperties(), null ) );
                 modelRequest.setModelCache( DefaultModelCache.newInstance( session ) );
                 modelRequest.setModelResolver( new DefaultModelResolver( session, trace.newChild( modelRequest ),
                                                                          request.getRequestContext(), artifactResolver,

Reply | Threaded
Open this post in threaded view
|

[maven] 02/08: Revert "[MNG-5982] Pass user properties to ModelBuildingRequest"

michaelo
In reply to this post by michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git

commit cc863d80f62ea87eb6051c7994291239aa949fae
Author: Sylwester Lachiewicz <[hidden email]>
AuthorDate: Wed Jan 1 16:01:14 2020 +0100

    Revert "[MNG-5982] Pass user properties to ModelBuildingRequest"
   
    This reverts commit 5553ff0ca6b9888a72343268cc3aa92489e424d9.
---
 .../maven/repository/internal/DefaultArtifactDescriptorReader.java       | 1 -
 1 file changed, 1 deletion(-)

diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
index 5146ea7..586c83e 100644
--- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
@@ -275,7 +275,6 @@ public class DefaultArtifactDescriptorReader
                 modelRequest.setTwoPhaseBuilding( false );
                 modelRequest.setSystemProperties( toProperties( session.getUserProperties(),
                                                                 session.getSystemProperties() ) );
-                modelRequest.setUserProperties( toProperties( session.getUserProperties(), null ) );
                 modelRequest.setModelCache( DefaultModelCache.newInstance( session ) );
                 modelRequest.setModelResolver( new DefaultModelResolver( session, trace.newChild( modelRequest ),
                                                                          request.getRequestContext(), artifactResolver,

Reply | Threaded
Open this post in threaded view
|

[maven] 03/08: [MNG-6841] update plexus-interpolation to 1.26

michaelo
In reply to this post by michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git

commit d86fda52925b27d758086cb1e0d2c9625d0e5f80
Author: artem.krosheninnikov <[hidden email]>
AuthorDate: Sun Jan 5 22:24:21 2020 +0300

    [MNG-6841] update plexus-interpolation to 1.26
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 21c05ab..7d24d56 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,7 +55,7 @@ under the License.
     <junitVersion>4.12</junitVersion>
     <mockitoVersion>3.2.0</mockitoVersion>
     <plexusVersion>2.1.0</plexusVersion>
-    <plexusInterpolationVersion>1.25</plexusInterpolationVersion>
+    <plexusInterpolationVersion>1.26</plexusInterpolationVersion>
     <plexusUtilsVersion>3.3.0</plexusUtilsVersion>
     <guiceVersion>4.2.2</guiceVersion>
     <sisuInjectVersion>0.3.4</sisuInjectVersion>

Reply | Threaded
Open this post in threaded view
|

[maven] 04/08: [MNG-6844] Use StandardCharsets and remove outdated @SuppressWarnings

michaelo
In reply to this post by michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 6017a9433cda4ca579bcc1749b5bf6e60ace1436
Author: Artem Krosheninnikov <[hidden email]>
AuthorDate: Thu Jan 9 11:12:22 2020 +0300

    [MNG-6844] Use StandardCharsets and remove outdated @SuppressWarnings
   
    This closes #312
---
 .../java/org/apache/maven/settings/GlobalSettingsTest.java    |  3 ++-
 .../src/main/java/org/apache/maven/building/StringSource.java |  3 ++-
 .../project/inheritance/DefaultModelInheritanceAssembler.java |  3 ---
 .../maven/artifact/AbstractArtifactComponentTestCase.java     |  3 ++-
 .../java/org/apache/maven/repository/legacy/StringWagon.java  | 10 ++--------
 .../apache/maven/artifact/handler/ArtifactHandlerTest.java    |  1 -
 .../maven/lifecycle/internal/stub/DefaultLifecyclesStub.java  |  1 -
 .../apache/maven/project/ExtensionDescriptorBuilderTest.java  | 11 ++---------
 .../src/main/java/org/apache/maven/cli/CLIManager.java        |  2 +-
 .../model/interpolation/ProblemDetectingValueSource.java      |  1 -
 10 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java b/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
index 0d0543e..257350c 100644
--- a/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
+++ b/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
@@ -26,6 +26,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.nio.charset.StandardCharsets;
 
 /**
  * Tests that the global settings.xml shipped with the distribution is in good state.
@@ -44,7 +45,7 @@ public class GlobalSettingsTest
         File globalSettingsFile = new File( basedir, "src/conf/settings.xml" );
         assertTrue( globalSettingsFile.getAbsolutePath(), globalSettingsFile.isFile() );
 
-        try ( Reader reader = new InputStreamReader( new FileInputStream( globalSettingsFile ), "UTF-8" ) )
+        try ( Reader reader = new InputStreamReader( new FileInputStream( globalSettingsFile ), StandardCharsets.UTF_8) )
         {
             new SettingsXpp3Reader().read( reader );
         }
diff --git a/maven-builder-support/src/main/java/org/apache/maven/building/StringSource.java b/maven-builder-support/src/main/java/org/apache/maven/building/StringSource.java
index f9d87c0..7705804 100644
--- a/maven-builder-support/src/main/java/org/apache/maven/building/StringSource.java
+++ b/maven-builder-support/src/main/java/org/apache/maven/building/StringSource.java
@@ -22,6 +22,7 @@ package org.apache.maven.building;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 
 /**
  * Wraps an ordinary {@link CharSequence} as a source.
@@ -62,7 +63,7 @@ public class StringSource
     public InputStream getInputStream()
         throws IOException
     {
-        return new ByteArrayInputStream( content.getBytes( "UTF-8" ) );
+        return new ByteArrayInputStream( content.getBytes( StandardCharsets.UTF_8 ) );
     }
 
     @Override
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 81ea92d..b0bbe66 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
@@ -55,7 +55,6 @@ public class DefaultModelInheritanceAssembler
     implements ModelInheritanceAssembler
 {
     // TODO Remove this!
-    @SuppressWarnings( "unchecked" )
     public void assembleBuildInheritance( Build childBuild, Build parentBuild, boolean handleAsInheritance )
     {
         // The build has been set but we want to step in here and fill in
@@ -307,7 +306,6 @@ public class DefaultModelInheritanceAssembler
     }
 
     // TODO Remove this!
-    @SuppressWarnings( "unchecked" )
     private void assembleDependencyManagementInheritance( Model child, Model parent )
     {
         DependencyManagement parentDepMgmt = parent.getDependencyManagement();
@@ -527,7 +525,6 @@ public class DefaultModelInheritanceAssembler
     }
 
     // TODO Remove this!
-    @SuppressWarnings( "unchecked" )
     private void assembleDependencyInheritance( Model child, Model parent )
     {
         Map<String, Dependency> depsMap = new LinkedHashMap<>();
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java b/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
index 2ce3794..dbd6e8f 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
@@ -59,6 +59,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -293,7 +294,7 @@ public abstract class AbstractArtifactComponentTestCase
         {
             artifactFile.getParentFile().mkdirs();
         }
-        try ( Writer writer = new OutputStreamWriter( new FileOutputStream( artifactFile ), "ISO-8859-1" ) )
+        try ( Writer writer = new OutputStreamWriter( new FileOutputStream( artifactFile ), StandardCharsets.ISO_8859_1) )
         {
             writer.write( artifact.getId() );
         }
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java
index 944cce6..3a72b98 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java
@@ -22,6 +22,7 @@ package org.apache.maven.repository.legacy;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -72,14 +73,7 @@ public class StringWagon
             resource.setContentLength( content.length() );
             resource.setLastModified( System.currentTimeMillis() );
 
-            try
-            {
-                inputData.setInputStream( new ByteArrayInputStream( content.getBytes( "UTF-8" ) ) );
-            }
-            catch ( UnsupportedEncodingException e )
-            {
-                throw new Error( "broken JVM", e );
-            }
+            inputData.setInputStream( new ByteArrayInputStream( content.getBytes( StandardCharsets.UTF_8 ) ) );
         }
         else
         {
diff --git a/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java b/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java
index 69f59fd..2803d8d 100644
--- a/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java
+++ b/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java
@@ -33,7 +33,6 @@ public class ArtifactHandlerTest
     {
         File apt = getTestFile( "src/site/apt/artifact-handlers.apt" );
 
-        @SuppressWarnings( "unchecked" )
         List<String> lines = FileUtils.loadFile( apt );
 
         for ( String line : lines )
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/DefaultLifecyclesStub.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/DefaultLifecyclesStub.java
index 1dc2b6b..a1a9532 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/DefaultLifecyclesStub.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/DefaultLifecyclesStub.java
@@ -47,7 +47,6 @@ public class DefaultLifecyclesStub
         List<String> stubSiteCycle =
             Arrays.asList( PRE_SITE.getPhase(), SITE.getPhase(), POST_SITE.getPhase(), SITE_DEPLOY.getPhase() );
 
-        @SuppressWarnings( "unchecked" )
         Iterator<List<String>> lcs = Arrays.asList( stubDefaultCycle, stubCleanCycle, stubSiteCycle ).iterator();
 
         Map<String, Lifecycle> lifeCycles = new HashMap<>();
diff --git a/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java
index 7a5e55d..5ac8f61 100644
--- a/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertThat;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 
 import junit.framework.TestCase;
@@ -61,14 +61,7 @@ public class ExtensionDescriptorBuilderTest
 
     private InputStream toStream( String xml )
     {
-        try
-        {
-            return new ByteArrayInputStream( xml.getBytes( "UTF-8" ) );
-        }
-        catch ( UnsupportedEncodingException e )
-        {
-            throw new IllegalStateException( e );
-        }
+        return new ByteArrayInputStream( xml.getBytes( StandardCharsets.UTF_8 ) );
     }
 
     public void testEmptyDescriptor()
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
index ec5e1b1..c9e002a 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
@@ -107,7 +107,7 @@ public class CLIManager
 
     protected Options options;
 
-    @SuppressWarnings( { "static-access", "checkstyle:linelength" } )
+    @SuppressWarnings( "checkstyle:linelength" )
     public CLIManager()
     {
         options = new Options();
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java
index 4ed98d0..0b29f20 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java
@@ -72,7 +72,6 @@ class ProblemDetectingValueSource
     }
 
     @Override
-    @SuppressWarnings( "unchecked" )
     public List getFeedback()
     {
         return valueSource.getFeedback();

Reply | Threaded
Open this post in threaded view
|

[maven] 05/08: [MNG-6842] ProjectBuilderTest uses Guava, but Guava is not defined in dependencies

michaelo
In reply to this post by michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git

commit c1e0f88f75da8883633a98815f2360c0cfe20c67
Author: Artem Krosheninnikov <[hidden email]>
AuthorDate: Mon Jan 6 17:28:39 2020 +0300

    [MNG-6842] ProjectBuilderTest uses Guava, but Guava is not defined in dependencies
   
    This closes #311
---
 .../org/apache/maven/project/ProjectBuilderTest.java | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
index 4833b00..da43088 100644
--- a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
@@ -26,6 +26,8 @@ import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertThat;
 
 import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -39,7 +41,6 @@ import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.model.building.ModelSource;
 import org.apache.maven.shared.utils.io.FileUtils;
 
-import com.google.common.io.Files;
 
 public class ProjectBuilderTest
     extends AbstractCoreMavenComponentTestCase
@@ -142,19 +143,20 @@ public class ProjectBuilderTest
         String initialValue = System.setProperty( DefaultProjectBuilder.DISABLE_GLOBAL_MODEL_CACHE_SYSTEM_PROPERTY, Boolean.toString( true ) );
         // TODO a similar test should be created to test the dependency management (basically all usages
         // of DefaultModelBuilder.getCache() are affected by MNG-6530
-        File tempDir = Files.createTempDir();
-        FileUtils.copyDirectoryStructure (new File( "src/test/resources/projects/grandchild-check"), tempDir );
+
+        Path tempDir = Files.createTempDirectory( null );
+        FileUtils.copyDirectoryStructure ( new File( "src/test/resources/projects/grandchild-check" ), tempDir.toFile() );
         try
         {
             MavenSession mavenSession = createMavenSession( null );
             ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
             configuration.setRepositorySession( mavenSession.getRepositorySession() );
             org.apache.maven.project.ProjectBuilder projectBuilder = lookup( org.apache.maven.project.ProjectBuilder.class );
-            File child = new File( tempDir, "child/pom.xml" );
+            File child = new File( tempDir.toFile(), "child/pom.xml" );
             // build project once
             projectBuilder.build( child, configuration );
             // modify parent
-            File parent = new File( tempDir, "pom.xml" );
+            File parent = new File( tempDir.toFile(), "pom.xml" );
             String parentContent = FileUtils.fileRead( parent );
             parentContent = parentContent.replaceAll( "<packaging>pom</packaging>",
              "<packaging>pom</packaging><properties><addedProperty>addedValue</addedProperty></properties>" );
@@ -173,7 +175,7 @@ public class ProjectBuilderTest
             {
                 System.setProperty( DefaultProjectBuilder.DISABLE_GLOBAL_MODEL_CACHE_SYSTEM_PROPERTY, initialValue );
             }
-            FileUtils.deleteDirectory( tempDir );
+            FileUtils.deleteDirectory( tempDir.toFile() );
         }
     }
 
@@ -303,7 +305,7 @@ public class ProjectBuilderTest
         return null;
     }
 
-    private void assertResultShowNoError(List<ProjectBuildingResult> results)
+    private void assertResultShowNoError( List<ProjectBuildingResult> results )
     {
         for ( ProjectBuildingResult result : results )
         {
@@ -320,8 +322,8 @@ public class ProjectBuilderTest
         ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
         configuration.setRepositorySession( mavenSession.getRepositorySession() );
         configuration.setResolveDependencies( true );
-        List<ProjectBuildingResult> result = projectBuilder.build( Collections.singletonList(file), true, configuration );
-        MavenProject project = result.get(0).getProject();
+        List<ProjectBuildingResult> result = projectBuilder.build( Collections.singletonList( file ), true, configuration );
+        MavenProject project = result.get( 0 ).getProject();
         // verify a few typical parameters are not duplicated
         assertEquals( 1, project.getTestCompileSourceRoots().size() );
         assertEquals( 1, project.getCompileSourceRoots().size() );

Reply | Threaded
Open this post in threaded view
|

[maven] 06/08: [MNG-6844] Remove outdated TODOs

michaelo
In reply to this post by michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git

commit b9b1c50f5154faeb34faf08385858fd7cd77aa9e
Author: Rostislav Krasny <[hidden email]>
AuthorDate: Fri Jan 10 00:57:50 2020 +0200

    [MNG-6844] Remove outdated TODOs
   
    Relates to the 735b72fcf1b848ee424d6755e5a624fbcbc65862 commit.
---
 .../maven/project/inheritance/DefaultModelInheritanceAssembler.java    | 3 ---
 1 file changed, 3 deletions(-)

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 b0bbe66..f21b99b 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
@@ -54,7 +54,6 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
 public class DefaultModelInheritanceAssembler
     implements ModelInheritanceAssembler
 {
-    // TODO Remove this!
     public void assembleBuildInheritance( Build childBuild, Build parentBuild, boolean handleAsInheritance )
     {
         // The build has been set but we want to step in here and fill in
@@ -305,7 +304,6 @@ public class DefaultModelInheritanceAssembler
         child.setProperties( props );
     }
 
-    // TODO Remove this!
     private void assembleDependencyManagementInheritance( Model child, Model parent )
     {
         DependencyManagement parentDepMgmt = parent.getDependencyManagement();
@@ -524,7 +522,6 @@ public class DefaultModelInheritanceAssembler
 
     }
 
-    // TODO Remove this!
     private void assembleDependencyInheritance( Model child, Model parent )
     {
         Map<String, Dependency> depsMap = new LinkedHashMap<>();

Reply | Threaded
Open this post in threaded view
|

[maven] 07/08: [MNG-6847] Explicit type can be replaced by the diamond operator

michaelo
In reply to this post by michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git

commit b95c4fc1a6abcfeb3c8179fe4cbde04bf3e80838
Author: Artem Krosheninnikov <[hidden email]>
AuthorDate: Mon Jan 13 19:39:45 2020 +0300

    [MNG-6847] Explicit type can be replaced by the diamond operator
   
    This closes #315
---
 .../resolver/MultipleArtifactsNotFoundException.java         |  2 +-
 .../org/apache/maven/artifact/versioning/VersionRange.java   |  4 ++--
 .../org/apache/maven/building/DefaultProblemCollector.java   |  2 +-
 .../maven/artifact/resolver/DefaultArtifactResolver.java     |  2 +-
 .../java/org/apache/maven/DuplicateProjectException.java     |  2 +-
 .../execution/DefaultMavenExecutionRequestPopulator.java     |  2 +-
 .../apache/maven/execution/DefaultMavenExecutionResult.java  |  4 ++--
 .../apache/maven/graph/FilteredProjectDependencyGraph.java   |  2 +-
 .../internal/DefaultLifecycleExecutionPlanCalculator.java    |  4 ++--
 .../apache/maven/lifecycle/internal/DependencyContext.java   |  4 ++--
 .../maven/lifecycle/internal/LifecycleModuleBuilder.java     |  3 +--
 .../apache/maven/lifecycle/internal/ReactorBuildStatus.java  |  2 +-
 .../internal/builder/multithreaded/ThreadOutputMuxer.java    |  2 +-
 .../java/org/apache/maven/project/DefaultProjectBuilder.java | 12 ++++++------
 .../src/main/java/org/apache/maven/project/MavenProject.java |  2 +-
 .../maven/project/artifact/DefaultMavenMetadataCache.java    |  8 ++++----
 .../org/apache/maven/toolchain/DefaultToolchainManager.java  |  2 +-
 .../toolchain/building/DefaultToolchainsBuildingResult.java  |  2 +-
 .../apache/maven/lifecycle/internal/BuilderCommonTest.java   |  2 +-
 .../maven/lifecycle/internal/stub/CompletionServiceStub.java |  2 +-
 .../maven/lifecycle/internal/stub/MojoExecutorStub.java      |  2 +-
 .../maven/cli/transfer/ConsoleMavenTransferListener.java     |  2 +-
 .../org/apache/maven/model/building/DefaultModelBuilder.java |  2 +-
 .../repository/internal/RemoteSnapshotMetadataTest.java      |  2 +-
 .../settings/building/DefaultSettingsBuildingResult.java     |  2 +-
 .../settings/building/DefaultSettingsProblemCollector.java   |  2 +-
 .../settings/crypto/DefaultSettingsDecryptionResult.java     |  6 +++---
 27 files changed, 41 insertions(+), 42 deletions(-)

diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/MultipleArtifactsNotFoundException.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/MultipleArtifactsNotFoundException.java
index 896710f..d08dfd5 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/MultipleArtifactsNotFoundException.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/MultipleArtifactsNotFoundException.java
@@ -41,7 +41,7 @@ public class MultipleArtifactsNotFoundException
                                                List<Artifact> missingArtifacts,
                                                List<ArtifactRepository> remoteRepositories )
     {
-        this( originatingArtifact, new ArrayList<Artifact>(), missingArtifacts, remoteRepositories );
+        this( originatingArtifact, new ArrayList<>(), missingArtifacts, remoteRepositories );
     }
 
     /**
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
index bbc6523..d2409dd 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
@@ -37,10 +37,10 @@ import org.apache.maven.artifact.Artifact;
 public class VersionRange
 {
     private static final Map<String, VersionRange> CACHE_SPEC =
-        Collections.<String, VersionRange>synchronizedMap( new WeakHashMap<String, VersionRange>() );
+        Collections.synchronizedMap( new WeakHashMap<>() );
 
     private static final Map<String, VersionRange> CACHE_VERSION =
-                    Collections.<String, VersionRange>synchronizedMap( new WeakHashMap<String, VersionRange>() );
+                    Collections.synchronizedMap( new WeakHashMap<>() );
 
     private final ArtifactVersion recommendedVersion;
 
diff --git a/maven-builder-support/src/main/java/org/apache/maven/building/DefaultProblemCollector.java b/maven-builder-support/src/main/java/org/apache/maven/building/DefaultProblemCollector.java
index 8502942..2c09df6 100644
--- a/maven-builder-support/src/main/java/org/apache/maven/building/DefaultProblemCollector.java
+++ b/maven-builder-support/src/main/java/org/apache/maven/building/DefaultProblemCollector.java
@@ -38,7 +38,7 @@ class DefaultProblemCollector
 
     DefaultProblemCollector( List<Problem> problems )
     {
-        this.problems = ( problems != null ) ? problems : new ArrayList<Problem>();
+        this.problems = ( problems != null ) ? problems : new ArrayList<>();
     }
 
     @Override
diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
index 2d1d8d9..44fdcdb 100644
--- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
+++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
@@ -116,7 +116,7 @@ public class DefaultArtifactResolver
         else
         {
             executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
-                                               new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
+                    new LinkedBlockingQueue<>(), new DaemonThreadCreator() );
         }
     }
 
diff --git a/maven-core/src/main/java/org/apache/maven/DuplicateProjectException.java b/maven-core/src/main/java/org/apache/maven/DuplicateProjectException.java
index b139872..5d7cec1 100644
--- a/maven-core/src/main/java/org/apache/maven/DuplicateProjectException.java
+++ b/maven-core/src/main/java/org/apache/maven/DuplicateProjectException.java
@@ -45,7 +45,7 @@ public class DuplicateProjectException
     {
         super( message, (File) null );
 
-        this.collisions = ( collisions != null ) ? collisions : new LinkedHashMap<String, List<File>>();
+        this.collisions = ( collisions != null ) ? collisions : new LinkedHashMap<>();
     }
 
     /**
diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
index ec9419c..6951c91 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
@@ -78,7 +78,7 @@ public class DefaultMavenExecutionRequestPopulator
             {
                 if ( !groupedToolchains.containsKey( model.getType() ) )
                 {
-                    groupedToolchains.put( model.getType(), new ArrayList<ToolchainModel>() );
+                    groupedToolchains.put( model.getType(), new ArrayList<>() );
                 }
 
                 groupedToolchains.get( model.getType() ).add( model );
diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
index 112a064..6ab1daa 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
@@ -41,7 +41,7 @@ public class DefaultMavenExecutionResult
     private final List<Throwable> exceptions = new CopyOnWriteArrayList<>();
 
     private final Map<MavenProject, BuildSummary> buildSummaries =
-        Collections.synchronizedMap( new IdentityHashMap<MavenProject, BuildSummary>() );
+        Collections.synchronizedMap( new IdentityHashMap<>() );
 
     public MavenExecutionResult setProject( MavenProject project )
     {
@@ -65,7 +65,7 @@ public class DefaultMavenExecutionResult
     public List<MavenProject> getTopologicallySortedProjects()
     {
         return null == topologicallySortedProjects
-                   ? Collections.<MavenProject>emptyList()
+                   ? Collections.emptyList()
                    : Collections.unmodifiableList( topologicallySortedProjects );
 
     }
diff --git a/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java b/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java
index 5097e4a..97ba57e 100644
--- a/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java
+++ b/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java
@@ -56,7 +56,7 @@ class FilteredProjectDependencyGraph
         this.projectDependencyGraph =
                 Objects.requireNonNull( projectDependencyGraph, "projectDependencyGraph cannot be null" );
 
-        this.whiteList = new IdentityHashMap<MavenProject, Object>();
+        this.whiteList = new IdentityHashMap<>();
 
         for ( MavenProject project : whiteList )
         {
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
index ef60c4e..833705c 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
@@ -179,7 +179,7 @@ public class DefaultLifecycleExecutionPlanCalculator
 
         finalizeMojoConfiguration( mojoExecution );
 
-        calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() );
+        calculateForkedExecutions( mojoExecution, session, project, new HashSet<>() );
     }
 
     public List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject project, List<Object> tasks )
@@ -331,7 +331,7 @@ public class DefaultLifecycleExecutionPlanCalculator
         PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
         LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
     {
-        calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet<MojoDescriptor>() );
+        calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet<>() );
     }
 
     private void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session, MavenProject project,
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java
index 7ee499f..55b14d6 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java
@@ -62,8 +62,8 @@ public class DependencyContext
         this.project = project;
         scopesToCollectForCurrentProject = scopesToCollect;
         scopesToResolveForCurrentProject = scopesToResolve;
-        scopesToCollectForAggregatedProjects = Collections.synchronizedSet( new TreeSet<String>() );
-        scopesToResolveForAggregatedProjects = Collections.synchronizedSet( new TreeSet<String>() );
+        scopesToCollectForAggregatedProjects = Collections.synchronizedSet( new TreeSet<>() );
+        scopesToResolveForAggregatedProjects = Collections.synchronizedSet( new TreeSet<>() );
     }
 
     public MavenProject getProject()
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
index 548fe6c..3391e0c 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
@@ -22,7 +22,6 @@ package org.apache.maven.lifecycle.internal;
 import java.util.HashSet;
 import java.util.List;
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.BuildSuccess;
 import org.apache.maven.execution.ExecutionEvent;
 import org.apache.maven.execution.MavenSession;
@@ -108,7 +107,7 @@ public class LifecycleModuleBuilder
             eventCatapult.fire( ExecutionEvent.Type.ProjectStarted, session, null );
 
             MavenExecutionPlan executionPlan =
-                builderCommon.resolveBuildPlan( session, currentProject, taskSegment, new HashSet<Artifact>() );
+                builderCommon.resolveBuildPlan( session, currentProject, taskSegment, new HashSet<>() );
             List<MojoExecution> mojoExecutions = executionPlan.getMojoExecutions();
 
             projectExecutionListener.beforeProjectLifecycleExecution( new ProjectExecutionEvent( session,
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java
index 2e2c3fd..9bd8b86 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java
@@ -37,7 +37,7 @@ public class ReactorBuildStatus
 {
     private final ProjectDependencyGraph projectDependencyGraph;
 
-    private final Collection<String> blackListedProjects = Collections.synchronizedSet( new HashSet<String>() );
+    private final Collection<String> blackListedProjects = Collections.synchronizedSet( new HashSet<>() );
 
     private volatile boolean halted = false;
 
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java
index 1732896..d17a20e 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java
@@ -56,7 +56,7 @@ public class ThreadOutputMuxer
 
     private final PrintStream defaultPrintStream = new PrintStream( defaultOutputStreamForUnknownData );
 
-    private final Set<ProjectSegment> completedBuilds = Collections.synchronizedSet( new HashSet<ProjectSegment>() );
+    private final Set<ProjectSegment> completedBuilds = Collections.synchronizedSet( new HashSet<>() );
 
     private volatile ProjectSegment currentBuild;
 
diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
index 7e18f1e..c5bf26c 100644
--- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
+++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
@@ -185,8 +185,8 @@ public class DefaultProjectBuilder
 
                 modelProblems = result.getProblems();
 
-                initProject( project, Collections.<String, MavenProject>emptyMap(), true,
-                             result, new HashMap<File, Boolean>(), projectBuildingRequest );
+                initProject( project, Collections.emptyMap(), true,
+                             result, new HashMap<>(), projectBuildingRequest );
             }
             else if ( projectBuildingRequest.isResolveDependencies() )
             {
@@ -374,7 +374,7 @@ public class DefaultProjectBuilder
         Map<String, MavenProject> projectIndex = new HashMap<>( 256 );
 
         boolean noErrors =
-            build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<File>(), true, recursive,
+            build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<>(), true, recursive,
                    config );
 
         populateReactorModelPool( modelPool, interimResults );
@@ -384,8 +384,8 @@ public class DefaultProjectBuilder
         try
         {
             noErrors =
-                build( results, new ArrayList<MavenProject>(), projectIndex, interimResults, request,
-                       new HashMap<File, Boolean>(), config.session ) && noErrors;
+                build( results, new ArrayList<>(), projectIndex, interimResults, request,
+                        new HashMap<>(), config.session ) && noErrors;
         }
         finally
         {
@@ -465,7 +465,7 @@ public class DefaultProjectBuilder
         try
         {
             // first pass: build without building parent.
-            initProject( project, projectIndex, false, result, new HashMap<File, Boolean>( 0 ), config.request );
+            initProject( project, projectIndex, false, result, new HashMap<>( 0 ), config.request );
         }
         catch ( InvalidArtifactRTException iarte )
         {
diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
index ceb39e2..896d641 100644
--- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
+++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
@@ -175,7 +175,7 @@ public class MavenProject
 
     private DependencyFilter extensionDependencyFilter;
 
-    private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<String>() );
+    private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<>() );
 
     public MavenProject()
     {
diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
index 6f2eb08..3db7bb7 100644
--- a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
+++ b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
@@ -220,14 +220,14 @@ public class DefaultMavenMetadataCache
         {
             this.pomArtifact = ArtifactUtils.copyArtifact( pomArtifact );
             this.relocatedArtifact = ArtifactUtils.copyArtifactSafe( relocatedArtifact );
-            this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList<Artifact>() );
+            this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList<>() );
             this.remoteRepositories = new ArrayList<>( remoteRepositories );
 
             this.managedVersions = managedVersions;
             if ( managedVersions != null )
             {
                 this.managedVersions =
-                    ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() );
+                    ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<>() );
             }
 
             File pomFile = pomArtifact.getFile();
@@ -310,11 +310,11 @@ public class DefaultMavenMetadataCache
             Artifact pomArtifact = ArtifactUtils.copyArtifact( cacheRecord.getArtifact() );
             Artifact relocatedArtifact = ArtifactUtils.copyArtifactSafe( cacheRecord.getRelocatedArtifact() );
             Set<Artifact> artifacts =
-                ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet<Artifact>() );
+                ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet<>() );
             Map<String, Artifact> managedVersions = cacheRecord.getManagedVersions();
             if ( managedVersions != null )
             {
-                managedVersions = ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() );
+                managedVersions = ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<>() );
             }
             return new ResolutionGroup( pomArtifact, relocatedArtifact, artifacts, managedVersions,
                                         cacheRecord.getRemoteRepositories() );
diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java b/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java
index 0bdee11..4c60aa4 100644
--- a/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java
+++ b/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java
@@ -129,7 +129,7 @@ public class DefaultToolchainManager
             }
         }
 
-        return ( context != null ) ? context : new HashMap<String, Object>();
+        return ( context != null ) ? context : new HashMap<>();
     }
 
     public static final String getStorageKey( String type )
diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java b/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java
index 60ca244..4cad090 100644
--- a/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java
+++ b/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java
@@ -48,7 +48,7 @@ public class DefaultToolchainsBuildingResult
     public DefaultToolchainsBuildingResult( PersistedToolchains effectiveToolchains, List<Problem> problems )
     {
         this.effectiveToolchains = effectiveToolchains;
-        this.problems = ( problems != null ) ? problems : new ArrayList<Problem>();
+        this.problems = ( problems != null ) ? problems : new ArrayList<>();
     }
 
     @Override
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuilderCommonTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuilderCommonTest.java
index 6f896d8..02fd595 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuilderCommonTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuilderCommonTest.java
@@ -45,7 +45,7 @@ public class BuilderCommonTest
         final BuilderCommon builderCommon = getBuilderCommon();
         final MavenExecutionPlan plan =
             builderCommon.resolveBuildPlan( session1, ProjectDependencyGraphStub.A, taskSegment1,
-                                            new HashSet<Artifact>() );
+                    new HashSet<>() );
         assertEquals( LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan().size(), plan.size() );
 
     }
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/CompletionServiceStub.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/CompletionServiceStub.java
index 8d4a04b..6c7acea 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/CompletionServiceStub.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/CompletionServiceStub.java
@@ -33,7 +33,7 @@ public class CompletionServiceStub
     implements CompletionService<ProjectSegment>
 {
     List<FutureTask<ProjectSegment>> projectBuildFutureTasks =
-        Collections.synchronizedList( new ArrayList<FutureTask<ProjectSegment>>() );
+        Collections.synchronizedList(new ArrayList<>() );
 
     final boolean finishImmediately;
 
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/MojoExecutorStub.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/MojoExecutorStub.java
index 8a6580b..250e60d 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/MojoExecutorStub.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/MojoExecutorStub.java
@@ -36,7 +36,7 @@ public class MojoExecutorStub
     extends MojoExecutor
 { // This is being lazy instead of making interface
 
-    public List<MojoExecution> executions = Collections.synchronizedList( new ArrayList<MojoExecution>() );
+    public List<MojoExecution> executions = Collections.synchronizedList(new ArrayList<>() );
 
     @Override
     public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java
index 1ad943b..950b5d0 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java
@@ -41,7 +41,7 @@ public class ConsoleMavenTransferListener
 {
 
     private Map<TransferResource, Long> transfers = Collections.synchronizedMap(
-                                                        new LinkedHashMap<TransferResource, Long>() );
+            new LinkedHashMap<>() );
 
     private boolean printResourceNames;
     private int lastLength;
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index f981944..e341086 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -437,7 +437,7 @@ public class DefaultModelBuilder
     public ModelBuildingResult build( ModelBuildingRequest request, ModelBuildingResult result )
         throws ModelBuildingException
     {
-        return build( request, result, new LinkedHashSet<String>() );
+        return build( request, result, new LinkedHashSet<>() );
     }
 
     private ModelBuildingResult build( ModelBuildingRequest request, ModelBuildingResult result,
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
index 278231f..3540bf2 100644
--- a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
@@ -75,7 +75,7 @@ public class RemoteSnapshotMetadataTest
         String datePart = ts.replaceAll( "\\..*", "" );
 
         /* Allow for this test running across midnight */
-        Set<String> expected = new HashSet<String>( Arrays.asList( dateBefore, dateAfter ) );
+        Set<String> expected = new HashSet<>( Arrays.asList( dateBefore, dateAfter ) );
         assertTrue( "Expected " + datePart + " to be in " + expected,
                 expected.contains( datePart ) );
     }
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java
index 187031e..48456e5 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java
@@ -40,7 +40,7 @@ class DefaultSettingsBuildingResult
     DefaultSettingsBuildingResult( Settings effectiveSettings, List<SettingsProblem> problems )
     {
         this.effectiveSettings = effectiveSettings;
-        this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
+        this.problems = ( problems != null ) ? problems : new ArrayList<>();
     }
 
     @Override
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java
index 65c74c0..024f5a7 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java
@@ -39,7 +39,7 @@ class DefaultSettingsProblemCollector
 
     DefaultSettingsProblemCollector( List<SettingsProblem> problems )
     {
-        this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
+        this.problems = ( problems != null ) ? problems : new ArrayList<>();
     }
 
     public List<SettingsProblem> getProblems()
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java
index 4458c61..ccdad19 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java
@@ -43,9 +43,9 @@ class DefaultSettingsDecryptionResult
 
     DefaultSettingsDecryptionResult( List<Server> servers, List<Proxy> proxies, List<SettingsProblem> problems )
     {
-        this.servers = ( servers != null ) ? servers : new ArrayList<Server>();
-        this.proxies = ( proxies != null ) ? proxies : new ArrayList<Proxy>();
-        this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
+        this.servers = ( servers != null ) ? servers : new ArrayList<>();
+        this.proxies = ( proxies != null ) ? proxies : new ArrayList<>();
+        this.problems = ( problems != null ) ? problems : new ArrayList<>();
     }
 
     @Override

Reply | Threaded
Open this post in threaded view
|

[maven] 08/08: [MNG-6837] Simplify detection of the MAVEN_HOME and make it fully qualified on Windows

michaelo
In reply to this post by michaelo
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6837
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 6ab1bb74e92d6db0c187c9afbdb70ac153c68ca9
Author: Rostislav Krasny <[hidden email]>
AuthorDate: Wed Jan 1 20:30:15 2020 +0200

    [MNG-6837] Simplify detection of the MAVEN_HOME and make it fully qualified on Windows
   
    The removed 'stripMHome' recursive function is not needed anymore
   
    This closes #307
---
 apache-maven/src/bin/mvn.cmd | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index fd1b21e..693b909 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -60,15 +60,11 @@ echo NB: JAVA_HOME should point to a JDK not a JRE >&2
 goto error
 
 :chkMHome
-set "MAVEN_HOME=%~dp0.."
-if not "%MAVEN_HOME%"=="" goto stripMHome
+set "MAVEN_HOME=%~dp0"
+set "MAVEN_HOME=%MAVEN_HOME:~0,-5%"
+if not "%MAVEN_HOME%"=="" goto checkMCmd
 goto error
 
-:stripMHome
-if not "_%MAVEN_HOME:~-1%"=="_\" goto checkMCmd
-set "MAVEN_HOME=%MAVEN_HOME:~0,-1%"
-goto stripMHome
-
 :checkMCmd
 if exist "%MAVEN_HOME%\bin\mvn.cmd" goto init
 goto error