You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/09/30 08:06:42 UTC

[GitHub] [maven] khmarbaise commented on a change in pull request #558: [MNG-7272] - Code Improvement - II

khmarbaise commented on a change in pull request #558:
URL: https://github.com/apache/maven/pull/558#discussion_r719160720



##########
File path: maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java
##########
@@ -126,43 +123,29 @@ public ProjectSorter( Collection<MavenProject> projects )
                          parent.getVersion(), true, false );
             }
 
-            List<Plugin> buildPlugins = project.getBuildPlugins();
-            if ( buildPlugins != null )

Review comment:
       Yes I know that the old code implied that there might be `null` an option but If you take a look into `project.getBuildPlugins();`
   ```java
       public List<Plugin> getBuildPlugins()
       {
           if ( getModel().getBuild() == null )
           {
               return Collections.emptyList();
           }
           return Collections.unmodifiableList( getModel().getBuild().getPlugins() );
       }
   ```
   furthermore the part: `getModel().getBuild().getPlugins()`:
   ```java
       public java.util.List<Plugin> getPlugins()
       {
           if ( this.plugins == null )
           {
               this.plugins = new java.util.ArrayList<Plugin>();
           }
   
           return this.plugins;
       } //-- java.util.List<Plugin> getPlugins()
   ```
   So can't be returning `null`...so the check does not make sense anymore.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org