gnodet-bot commented on code in PR #14069:
URL: https://github.com/apache/maven/pull/14069#discussion_r4619607264


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionProfileActivator.java:
##########
@@ -194,4 +194,13 @@ static String doGetProperty(ProfileActivationContext 
context, String name) {
         }
         return v;
     }
+
+    /**
+     * Determines whether the given profile originates from a POM file.
+     *
+     * @see ProfileSourceDetector#isFromPom(Profile)
+     */
+    private static boolean isFromPom(Profile profile) {

Review Comment:
   ⚠️ **Dead code — `isFromPom()` is never called in this class**
   
   This private method is added here but `ConditionProfileActivator.isActive()` 
and `presentInConfig()` do not call it. It delegates to 
`ProfileSourceDetector.isFromPom()` which is already accessible directly.
   
   If this wrapper is scaffolding for a future cascading-activation change, add 
a `// TODO: used by cascading activation (see #1774)` comment. Otherwise remove 
it — private uncalled methods generate IDE/checkstyle warnings and add noise to 
the class.
   
   ```suggestion
   }
   ```
   
   (Replace the entire `isFromPom` block with nothing — the closing `}` above 
closes the class.)



##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/PropertyProfileActivator.java:
##########
@@ -109,4 +109,13 @@ public boolean presentInConfig(Profile profile, 
ProfileActivationContext context
 
         return property != null;
     }
+
+    /**
+     * Determines whether the given profile originates from a POM file.
+     *
+     * @see ProfileSourceDetector#isFromPom(Profile)
+     */
+    private static boolean isFromPom(Profile profile) {

Review Comment:
   ⚠️ **Dead code — `isFromPom()` is never called in this class**
   
   Same issue as in `ConditionProfileActivator`: this private method is added 
but `PropertyProfileActivator.isActive()` and `presentInConfig()` do not call 
it. `ProfileSourceDetector.isFromPom()` is already accessible directly from 
wherever it is needed.
   
   Remove this wrapper or add a TODO comment explaining its future purpose.



##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ProfileSourceDetector.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+package org.apache.maven.impl.model.profile;
+
+import org.apache.maven.api.model.InputLocation;
+import org.apache.maven.api.model.InputSource;
+import org.apache.maven.api.model.Profile;
+
+/**
+ * Utility for detecting the origin of a {@link Profile}.
+ *
+ * <p>Since model version 4.2.0, {@link Profile} no longer carries a mutable 
{@code source}
+ * field. Origin is instead inferred from the {@link InputSource} attached to 
the profile's
+ * root {@link InputLocation}: a non-null, non-empty {@code modelId} means the 
profile was
+ * read from a POM file; an empty or null {@code modelId} indicates a settings 
profile
+ * (settings.xml converted via {@code SettingsUtilsV4.toLocation}).
+ *
+ * @since 4.2.0
+ */
+public final class ProfileSourceDetector {
+
+    private ProfileSourceDetector() {}
+
+    /**
+     * Returns {@code true} if the given profile originates from a POM file.
+     *

Review Comment:
   ℹ️ **`@since` tag is ambiguous on a 4.0.x backport**
   
   The class-level Javadoc says `@since 4.2.0`, but this class is introduced on 
the `maven-4.0.x` branch and will ship with 4.0.x releases. The `@since` tag by 
convention means "first Maven release containing this element" — which here is 
the first 4.0.x release after this PR merges, not 4.2.0.
   
   The description sentence "Since model version 4.2.0, `Profile` no longer 
carries a mutable `source` field" is accurate, but the `@since` tag itself 
should reflect the actual Maven release version.
   
   ```suggestion
    * @since 4.0.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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to