This is an automated email from the ASF dual-hosted git repository. mthmulders pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push: new ad24f59 [MNG-7051] Return unmodifiable profile lists ad24f59 is described below commit ad24f599cecf2cbaa94c0339d9256946f846b173 Author: Maarten Mulders <mthmuld...@apache.org> AuthorDate: Fri Feb 12 17:06:47 2021 +0100 [MNG-7051] Return unmodifiable profile lists This helps deprecation and keeps the code consistent. Closes #452. --- .../apache/maven/execution/MavenExecutionRequest.java | 16 ++++++++-------- .../org/apache/maven/execution/ProfileActivation.java | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index f31e33f..d0ac0f1 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -278,51 +278,51 @@ public interface MavenExecutionRequest MavenExecutionRequest setProfiles( List<Profile> 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<String> profiles ); /** - * @deprecated Use {@link #getProfileActivation()}. + * @deprecated Since Maven 4: use {@link #getProfileActivation()}. */ @Deprecated MavenExecutionRequest setActiveProfiles( List<String> profiles ); /** * @return The list of profiles that the user wants to activate. - * @deprecated Use {@link #getProfileActivation()}. + * @deprecated Since Maven 4: use {@link #getProfileActivation()}. */ @Deprecated List<String> getActiveProfiles(); /** - * @deprecated Use {@link #getProfileActivation()}. + * @deprecated Since Maven 4: use {@link #getProfileActivation()}. */ @Deprecated MavenExecutionRequest addInactiveProfile( String profile ); /** - * @deprecated Use {@link #getProfileActivation()}. + * @deprecated Since Maven 4: use {@link #getProfileActivation()}. */ @Deprecated MavenExecutionRequest addInactiveProfiles( List<String> profiles ); /** - * @deprecated Use {@link #getProfileActivation()}. + * @deprecated Since Maven 4: use {@link #getProfileActivation()}. */ @Deprecated MavenExecutionRequest setInactiveProfiles( List<String> profiles ); /** * @return The list of profiles that the user wants to de-activate. - * @deprecated Use {@link #getProfileActivation()}. + * @deprecated Since Maven 4: use {@link #getProfileActivation()}. */ @Deprecated List<String> getInactiveProfiles(); diff --git a/maven-core/src/main/java/org/apache/maven/execution/ProfileActivation.java b/maven-core/src/main/java/org/apache/maven/execution/ProfileActivation.java index 21530bd..1837696 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/ProfileActivation.java +++ b/maven-core/src/main/java/org/apache/maven/execution/ProfileActivation.java @@ -20,6 +20,7 @@ package org.apache.maven.execution; */ import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -74,7 +75,7 @@ public class ProfileActivation @Deprecated public List<String> getActiveProfiles() { - return new ArrayList<>( getProfileIds( pa -> pa.active ) ); + return Collections.unmodifiableList( new ArrayList<>( getProfileIds( pa -> pa.active ) ) ); } /** @@ -84,7 +85,7 @@ public class ProfileActivation @Deprecated public List<String> getInactiveProfiles() { - return new ArrayList<>( getProfileIds( pa -> !pa.active ) ); + return Collections.unmodifiableList( new ArrayList<>( getProfileIds( pa -> !pa.active ) ) ); } /**