gnodet-bot commented on code in PR #14066:
URL: https://github.com/apache/maven/pull/14066#discussion_r4619398832
##########
api/maven-api-core/src/main/java/org/apache/maven/api/Node.java:
##########
@@ -40,32 +40,85 @@
@Provider
public interface Node {
+ /**
+ * {@return the artifact}
+ *
+ * @since 4.0.0
+ */
+ @Nonnull
+ default Artifact artifact() {
Review Comment:
⚠️ **Nullability contract mismatch:** `artifact()` is `@Nonnull` but
delegates to `@Nullable getArtifact()`. The root node of a dependency tree has
no artifact — the getter legitimately returns `null`. Callers migrating from
`getArtifact()` (which they null-check) to `artifact()` (which they won't,
because `@Nonnull`) will get a silent NPE.
Same issue at `dependency()` below — `@Nonnull` delegating to `@Nullable
getDependency()`.
The noun-style methods must carry the same nullability contract as the
getters they delegate to:
```suggestion
@Nullable
default Artifact artifact() {
```
##########
api/maven-api-core/src/main/java/org/apache/maven/api/VersionConstraint.java:
##########
@@ -37,20 +37,42 @@
*/
@Experimental
public interface VersionConstraint {
+ /**
+ * {@return the versionRange}
+ *
+ * @since 4.0.0
+ */
+ @Nonnull
+ default VersionRange versionRange() {
Review Comment:
⚠️ **Nullability contract mismatch:** `versionRange()` is `@Nonnull` but
delegates to `@Nullable getVersionRange()`. The existing Javadoc on the getter
is explicit: _"only one, this method or `getRecommendedVersion()` must return
non-null value"_ — by contract, one of the two IS null for any valid
`VersionConstraint`. Same issue for `recommendedVersion()` below.
A caller using `vc.versionRange().contains(v)` will get NPE when the
constraint is a recommended version (not a range).
```suggestion
@Nullable
default VersionRange versionRange() {
```
##########
api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java:
##########
@@ -30,8 +31,30 @@
@Experimental
public interface Exclusion {
@Nullable
+ /**
+ * {@return the groupId}
+ *
+ * @since 4.0.0
+ */
+ @Nonnull
+ default String groupId() {
Review Comment:
⚠️ **Broken annotation ordering:** The pre-existing `@Nullable` on the class
body (before the new Javadoc block) now attaches to the new `groupId()` method,
not to `getGroupId()`. Result: `groupId()` has both `@Nullable` and `@Nonnull`
(contradictory), and `getGroupId()` lost its nullability annotation. Same issue
for `artifactId()`.
The original annotations were attached to the getters — the new insertions
shifted them. Move `@Nullable` back onto `getGroupId()` (after `@Deprecated`)
and decide whether the noun methods should be `@Nullable` or `@Nonnull`.
##########
api/maven-api-core/src/main/java/org/apache/maven/api/Session.java:
##########
@@ -128,7 +128,9 @@ default Map<String, String> getEffectiveProperties() {
* Returns the degree of concurrency for the build.
*
* @return the degree of concurrency
+ * @deprecated
*/
+ @Deprecated(since = "4.0.0", forRemoval = true)
int getDegreeOfConcurrency();
Review Comment:
⚠️ **Deprecated without a replacement:** `getDegreeOfConcurrency()` is
marked `@deprecated` with an empty tag — no "use X instead". There is no
`degreeOfConcurrency()` noun-style replacement in this PR. Every other
deprecated getter in this PR has a corresponding replacement method; this one
was missed.
Either add:
```java
default int degreeOfConcurrency() {
return getDegreeOfConcurrency();
}
```
or document why this method is being removed with no migration path.
##########
api/maven-api-log/src/main/java/org/apache/maven/api/logging/package-info.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+/**
+ * Maven unified logging API — a first-class, SLF4J-free logging facade for
+ * plugins and extensions.
+ *
+ * <h2>Core types</h2>
+ * <dl>
+ * <dt>{@link org.apache.maven.api.logging.Logger}</dt>
+ * <dd>The primary logging interface injected by the container. Supports a
fluent builder
+ * API ({@code atInfo()...log(...)}) as well as SLF4J-style convenience
methods
+ * ({@code info(...)}, {@code warn(...)}, etc.).</dd>
+ *
+ * <dt>{@link org.apache.maven.api.logging.LogEventBuilder}</dt>
+ * <dd>Fluent builder for a single log event, obtained from {@code
Logger.atLevel()}.
Review Comment:
📝 **Doc typo (carried forward — still not fixed):** `{@code
Logger.atLevel()}` does not exist. The actual method is `Logger.at(LogLevel)`.
```suggestion
* <dd>Fluent builder for a single log event, obtained from {@code
Logger.at(LogLevel)}.
```
##########
api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java:
##########
@@ -44,16 +44,38 @@ public interface VersionRange {
*/
boolean contains(@Nonnull Version version);
+ /**
+ * {@return the upperBoundary}
+ *
+ * @since 4.0.0
+ */
+ @Nonnull
+ default Boundary upperBoundary() {
Review Comment:
⚠️ **Nullability contract mismatch:** `upperBoundary()` and
`lowerBoundary()` are `@Nonnull` but delegate to `@Nullable` getters. An
unbounded range like `[1.0,)` has no upper boundary — `getUpperBoundary()`
returns `null` by design. The noun-style methods must preserve this:
```suggestion
@Nullable
default Boundary upperBoundary() {
```
--
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]