[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-03-09 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r591169720



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   @michael-o we have implemented all logic to make the 4 points in [the 
reply above](https://github.com/apache/maven/pull/446#discussion_r583679349) 
work. It's up for review again if you have some time :)





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-16 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r577123679



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   True, but that's now fixed with this last commit I did, right? You will 
now get the following:
   ```
   > mvn -pl !core-it-suite,:core-it-suite validate
   [INFO] Scanning for projects...
   [ERROR] The project exclusion settings resulted in an empty project list, 
please correct the usage of --projects/-pl ! or -
   ```





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-16 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r577045936



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   I agree, but I don't think I understand how it would ideally work. Would 
you want to let `-a,+:a` work the same way as `-a,+a` instead of have the 
exception thrown? (last one wins)





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-15 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r576420436



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   I guess it would, but I'm not sure how to fix it otherwise. What would 
you rather have? I don't think we can already check whether `a` or `:a` are the 
same in an earlier stage. 
   
   I've just committed the exception before I read your reply. Please let me 
know what you think.





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-15 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r576404399



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   "No goal" is definitely a bug. I'm thinking of throwing an exception 
when the reactor command line flags result in an empty project list.





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-15 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r576385701



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   Right, the data structure inside `ProjectActivation` is a 
`Map<(ProjectSelector)String, (enum)ActivationSetting>`, so that means that a 
project cannot be both turned selected and excluded. The one who gets set later 
wins (in `-pl !a,+a` '+a' wins).
   This was not fully intentional, but I don't dislike the outcome. The same 
goes for ProfileActivation, by the way.
   
   The bug remains though if the user invokes `mvn -pl -a,+:a` (same proj, 
different selector). It will output "No goals have been specified for this 
build.". I'll improve the error message in this case.





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575856204



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   I need a bit more time for this. The latest maven master build actually 
has the same bug as 3.6.3, but the build of this PR does not have the error. I 
need to go now, but will check tomorrow or something if I can find out why (and 
whether we want it 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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575853056



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   Actually.. this is the case for 3.6.3, the latest master actually builds 
the targeted project just fine. I'm not sure why it's not filtered out... Let 
me get back to that.





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575853056



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   Actually.. this is the case for 3.6.3, the latest master actually builds 
the targeted project just fine. I'm not sure it's not filtered out... Let me 
get back to that.





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575851985



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   Interesting question, the `DefaultGraphBuilder` will first filter based 
on the selected modules (+), afterwards it will filter out the excluded 
projects, so in this case nothing will be selected. Actually, it will result in 
a bug (I'll create a JIRA ticket for it)
   
   This is an attempt in the integration-test project:
   ```
   >mvn validate -pl !core-it-suite,+core-it-suite
   [INFO] Scanning for projects...
   [INFO] 

   [INFO] BUILD FAILURE
   [INFO] 

   [INFO] Total time:  0.630 s
   [INFO] Finished at: 2021-02-14T20:15:52+01:00
   [INFO] 

   [ERROR] No goals have been specified for this build. You must specify a 
valid lifecycle phase or a goal in the format : or 
:[:]:. Available 
lifecycle phases are: validate, initialize, generate-sources, process-sources, 
generate-reso
   urces, process-resources, compile, process-classes, generate-test-sources, 
process-test-sources, generate-test-resources, process-test-resources, 
test-compile, process-test-classes, test, prepare-package, package, 
pre-integration-test, integration-test, post-integration-test, verify, install, 
deploy, pre-clean,
clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]```





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575810640



##
File path: 
maven-core/src/main/java/org/apache/maven/execution/ProjectActivation.java
##
@@ -0,0 +1,173 @@
+package org.apache.maven.execution;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Predicate;
+
+import static java.util.stream.Collectors.toSet;
+
+/**
+ * Container for storing the request from the user to activate or de-activate 
certain projects and optionally fail the
+ * build if those projects do not exist.
+ */
+public class ProjectActivation
+{
+private final Map activations = new 
HashMap<>();
+
+/**
+ * Adds a project activation to the request.
+ * @param selector The selector of the project.

Review comment:
   I agree, it was not defined anywhere near this class (if at all). I've 
added it to each method where "selector" is mentioned. Do you think this is too 
much and rather only have it at class-level instead?





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575810315



##
File path: 
maven-core/src/main/java/org/apache/maven/execution/ActivationSettings.java
##
@@ -0,0 +1,58 @@
+package org.apache.maven.execution;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Describes whether something (a profile or a project) should be activated or 
not, and if that is required or optional.

Review comment:
   I agree, changed it accordingly





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575809881



##
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
 {
 List result = projects;
 
-if ( !request.getExcludedProjects().isEmpty() )
+ProjectActivation projectActivation = request.getProjectActivation();
+Set requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+Set optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
 {
-File reactorDirectory = getReactorDirectory( request );
+Set excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
   This piece of code removes the excluded projects (`-pl !proj` and `-pl 
-?proj`) from the reactor. The other method limits the reactor to all selected 
projects (`-pl proj,?proj`). Both methods find all projects by the project 
selectors and by whether they are required or optional.  





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575807467



##
File path: 
maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
##
@@ -278,55 +290,61 @@
 MavenExecutionRequest setProfiles( List profiles );
 
 /**
- * @deprecated Use {@link #getProfileActivation()}.
+ * @deprecated Since Maven 4: use {@link #getProfileActivation()}.
  */
 @Deprecated
 MavenExecutionRequest addActiveProfile( String profile );
 
 /**
- * @deprecated Use {@link #getProfileActivation()}.
+ * @deprecated Since Maven 4: use {@link #getProfileActivation()}.
  */
 @Deprecated
 MavenExecutionRequest addActiveProfiles( List profiles );
 
 /**
- * @deprecated Use {@link #getProfileActivation()}.
+ * @deprecated Since Maven 4: use {@link #getProfileActivation()}.

Review comment:
   Sure, will refactor it into a new PR after we've made a decision on the 
unmodifiableList change 
https://github.com/apache/maven/pull/446#discussion_r575807350





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:
us...@infra.apache.org




[GitHub] [maven] MartinKanters commented on a change in pull request #446: [MNG-6511] - Optional project selection

2021-02-14 Thread GitBox


MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r575807350



##
File path: 
maven-core/src/main/java/org/apache/maven/execution/ProfileActivation.java
##
@@ -74,7 +44,7 @@ static ActivationSettings of( final boolean active, final 
boolean optional )
 @Deprecated
 public List getActiveProfiles()
 {
-return new ArrayList<>( getProfileIds( pa -> pa.active ) );
+return Collections.unmodifiableList( new ArrayList<>( getProfileIds( 
pa -> pa.active ) ) );

Review comment:
   I understand your concern and usually we wouldn't have changed something 
like this all of a sudden. The reason why we did change it is because the 
current implementation returns a view of the active profiles in this case. If 
some extension or whatever would add elements to this list it will not have any 
effect. Our theory is that if we make it unmodifiable, we at throw an exception 
if someone tries this. This hopefully points the dev to the method and they 
notice the replacement methods. 





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:
us...@infra.apache.org