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 2019/12/23 14:33:05 UTC

[GitHub] [maven] KroArtem opened a new pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

KroArtem opened a new pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303
 
 
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[MNG-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MNG-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] khmarbaise commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
khmarbaise commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569248759
 
 
   @KroArtem Hi, can you please rebase your PR's against current master and please squash your commits...

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] KroArtem commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
KroArtem commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-570821032
 
 
   @khmarbaise , hello, I've rebased the PR and squashed it. @michael-o , it seems like you're still requesting a review.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] khmarbaise commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
khmarbaise commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361631106
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -259,7 +253,7 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
                                                              ArtifactNotFoundException
     {
         return resolveTransitively(
-                artifacts, originatingArtifact, Collections.<String, Artifact>emptyMap(), localRepository,
 
 Review comment:
   No need for a separate PR...

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] elharo commented on a change in pull request #303: [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #303: [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r364193755
 
 

 ##########
 File path: maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
 ##########
 @@ -241,20 +240,17 @@ private Settings interpolate( Settings settings, SettingsBuildingRequest request
                 + e.getMessage(), -1, -1, e );
         }
 
-        interpolator.addPostProcessor( new InterpolationPostProcessor()
+        interpolator.addPostProcessor( ( expression, value ) ->
         {
-            @Override
-            public Object execute( String expression, Object value )
+            if ( value != null )
             {
-                if ( value != null )
-                {
-                    // we're going to parse this back in as XML so we need to escape XML markup
-                    value = value.toString().replace( "&", "&amp;" ).replace( "<", "&lt;" ).replace( ">", "&gt;" );
-                    return value;
-                }
-                return null;
+                // we're going to parse this back in as XML so we need to escape XML markup
+                value = value.toString().replace( "&", "&amp;" ).replace( "<", "&lt;" ).replace( ">", "&gt;" );
 
 Review comment:
   Nothing specific and not this PR's problem to fix. It just happened to call my attention to it. I've just learned from experience that these sorts of replacements always go wrong. Just a note to myself to dig into this, really. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] khmarbaise commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
khmarbaise commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569239581
 
 
   Let's see what our CI says....

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] michael-o commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361713208
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -105,18 +105,12 @@ public DefaultArtifactResolver()
         int threads = Integer.getInteger( "maven.artifact.threads", 5 );
         if ( threads <= 1 )
         {
-            executor = new Executor()
-            {
-                public void execute( Runnable command )
-                {
-                    command.run();
-                }
-            };
+            executor = Runnable::run;
         }
         else
         {
             executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
-                                               new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
 
 Review comment:
   Let's leave as-is. In the future, try to avoid unrelated changes.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] michael-o commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
michael-o commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569042301
 
 
   > 
   > 
   > I don't find this makes the code easier to read. I prefer the inner classes in most of these cases.
   
   At some point, I do agree. But there are improvements which squash from 10 to one line. These are worth merging.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] asfgit closed pull request #303: [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #303: [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] KroArtem commented on issue #303: [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
KroArtem commented on issue #303: [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-572002994
 
 
   Are there any more things to fix here? If not, is it possible for someone to merge this?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] KroArtem commented on a change in pull request #303: [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
KroArtem commented on a change in pull request #303: [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r363115277
 
 

 ##########
 File path: maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
 ##########
 @@ -241,20 +240,17 @@ private Settings interpolate( Settings settings, SettingsBuildingRequest request
                 + e.getMessage(), -1, -1, e );
         }
 
-        interpolator.addPostProcessor( new InterpolationPostProcessor()
+        interpolator.addPostProcessor( ( expression, value ) ->
         {
-            @Override
-            public Object execute( String expression, Object value )
+            if ( value != null )
             {
-                if ( value != null )
-                {
-                    // we're going to parse this back in as XML so we need to escape XML markup
-                    value = value.toString().replace( "&", "&amp;" ).replace( "<", "&lt;" ).replace( ">", "&gt;" );
-                    return value;
-                }
-                return null;
+                // we're going to parse this back in as XML so we need to escape XML markup
+                value = value.toString().replace( "&", "&amp;" ).replace( "<", "&lt;" ).replace( ">", "&gt;" );
 
 Review comment:
   I had to google `dollars to donuts` to understand your comment :)
   
   Do you mean not only these conversions should be done? https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] olamy commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
olamy commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361613555
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -259,7 +253,7 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
                                                              ArtifactNotFoundException
     {
         return resolveTransitively(
-                artifacts, originatingArtifact, Collections.<String, Artifact>emptyMap(), localRepository,
 
 Review comment:
   why? sounds a bit nitpicking

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] olamy commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
olamy commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361613525
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -105,18 +105,12 @@ public DefaultArtifactResolver()
         int threads = Integer.getInteger( "maven.artifact.threads", 5 );
         if ( threads <= 1 )
         {
-            executor = new Executor()
-            {
-                public void execute( Runnable command )
-                {
-                    command.run();
-                }
-            };
+            executor = Runnable::run;
         }
         else
         {
             executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
-                                               new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
 
 Review comment:
   why? sounds a bit nitpicking

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] michael-o commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
michael-o commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569237224
 
 
   > Regarding refactoring in general: refactoring should be a constant factor. It is part of the process and IMO often doesn't deserve a separate issuenumber.
   
   I object that because every code change can introduce regressions.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] rfscholte commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
rfscholte commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569235422
 
 
   Regarding the lambda's in general: for those that have been programming Java for over 15 years (like me) having anonymous classes feels more comfortable. Reading lambda's takes time for us, because in our minds we keep trying to read them with inner classes.
   For the generation that grew up with lambda's it is a nobrainer.
   This is probably a good moment to let go the comfortzone. We know that while Maven was on Java 7 we missed new contributors providing patches because they couldn't use these Java 8 features.
   
   Regarding refactoring in general: refactoring should be a constant factor. It is part of the process and IMO often doesn't deserve a separate issuenumber.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] khmarbaise commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
khmarbaise commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361631118
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -307,7 +301,7 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
                                                              ArtifactNotFoundException
     {
         return resolveTransitively(
-                artifacts, originatingArtifact, Collections.<String, Artifact>emptyMap(), localRepository,
 
 Review comment:
   No need for a separate PR...

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] michael-o commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361435424
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -307,7 +301,7 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
                                                              ArtifactNotFoundException
     {
         return resolveTransitively(
-                artifacts, originatingArtifact, Collections.<String, Artifact>emptyMap(), localRepository,
 
 Review comment:
   This should be separate PR.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] michael-o commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361435404
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -105,18 +105,12 @@ public DefaultArtifactResolver()
         int threads = Integer.getInteger( "maven.artifact.threads", 5 );
         if ( threads <= 1 )
         {
-            executor = new Executor()
-            {
-                public void execute( Runnable command )
-                {
-                    command.run();
-                }
-            };
+            executor = Runnable::run;
         }
         else
         {
             executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
-                                               new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
 
 Review comment:
   This should be separate PR.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] KroArtem commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
KroArtem commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361658958
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -105,18 +105,12 @@ public DefaultArtifactResolver()
         int threads = Integer.getInteger( "maven.artifact.threads", 5 );
         if ( threads <= 1 )
         {
-            executor = new Executor()
-            {
-                public void execute( Runnable command )
-                {
-                    command.run();
-                }
-            };
+            executor = Runnable::run;
         }
         else
         {
             executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
-                                               new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
 
 Review comment:
   Please decide whether to make a separate PR or not 😃 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] khmarbaise edited a comment on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
khmarbaise edited a comment on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569238430
 
 
   > > Regarding refactoring in general: refactoring should be a constant factor. It is part of the process and IMO often doesn't deserve a separate issuenumber.
   > 
   > I object that because every code change can introduce regressions.
   
   I partially agree but that means in consequence our tests are not good enough...which means we have to enhance the tests we have or add new tests for those cases...
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] michael-o commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
michael-o commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569248522
 
 
   > 
   > 
   > > Regarding the lambda's in general: for those that have been programming Java for over 15 years (like me) having anonymous classes feels more comfortable. Reading lambda's takes time for us, because in our minds we keep trying to read them with inner classes.
   > > For the generation that grew up with lambda's it is a nobrainer.
   > 
   > If you really have a problem to understand a Lambda you can simply use your IDE to convert the Lambda back to old style ...if you do this several times you will understand how they work and it will become more and more familiar to read Lambdas.
   
   I join Robert here. Funny thing is that I have used lambdas way before I have used Java, namely with Haskell. It was a breeze to use.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] khmarbaise commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
khmarbaise commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569238430
 
 
   > > Regarding refactoring in general: refactoring should be a constant factor. It is part of the process and IMO often doesn't deserve a separate issuenumber.
   > 
   > I object that because every code change can introduce regressions.
   I partially agree but that means in consequence our tests are not good enough...which means we have to enhance the tests we have or add new tests for those cases...
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] michael-o commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361435416
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -259,7 +253,7 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
                                                              ArtifactNotFoundException
     {
         return resolveTransitively(
-                artifacts, originatingArtifact, Collections.<String, Artifact>emptyMap(), localRepository,
 
 Review comment:
   This should be separate PR.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] elharo commented on a change in pull request #303: [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #303: [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r363061855
 
 

 ##########
 File path: maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
 ##########
 @@ -241,20 +240,17 @@ private Settings interpolate( Settings settings, SettingsBuildingRequest request
                 + e.getMessage(), -1, -1, e );
         }
 
-        interpolator.addPostProcessor( new InterpolationPostProcessor()
+        interpolator.addPostProcessor( ( expression, value ) ->
         {
-            @Override
-            public Object execute( String expression, Object value )
+            if ( value != null )
             {
-                if ( value != null )
-                {
-                    // we're going to parse this back in as XML so we need to escape XML markup
-                    value = value.toString().replace( "&", "&amp;" ).replace( "<", "&lt;" ).replace( ">", "&gt;" );
-                    return value;
-                }
-                return null;
+                // we're going to parse this back in as XML so we need to escape XML markup
+                value = value.toString().replace( "&", "&amp;" ).replace( "<", "&lt;" ).replace( ">", "&gt;" );
 
 Review comment:
   not changed in this PR, but dollars to donuts this conversion is buggy

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] khmarbaise commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
khmarbaise commented on issue #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#issuecomment-569245080
 
 
   > Regarding the lambda's in general: for those that have been programming Java for over 15 years (like me) having anonymous classes feels more comfortable. Reading lambda's takes time for us, because in our minds we keep trying to read them with inner classes.
   > For the generation that grew up with lambda's it is a nobrainer.
   
   If you really have a problem to understand a Lambda you can simply use your IDE to convert the Lambda back to old style ...if you do this several times you will understand how they work and it will become more and more familiar to read Lambdas.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] khmarbaise commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas

Posted by GitBox <gi...@apache.org>.
khmarbaise commented on a change in pull request #303: [wip] [MNG-6831] replace anonymous classes by lambdas
URL: https://github.com/apache/maven/pull/303#discussion_r361631070
 
 

 ##########
 File path: maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
 ##########
 @@ -105,18 +105,12 @@ public DefaultArtifactResolver()
         int threads = Integer.getInteger( "maven.artifact.threads", 5 );
         if ( threads <= 1 )
         {
-            executor = new Executor()
-            {
-                public void execute( Runnable command )
-                {
-                    command.run();
-                }
-            };
+            executor = Runnable::run;
         }
         else
         {
             executor = new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS,
-                                               new LinkedBlockingQueue<Runnable>(), new DaemonThreadCreator() );
 
 Review comment:
   No need for a separate PR...

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services