gnodet-bot commented on code in PR #14068:
URL: https://github.com/apache/maven/pull/14068#discussion_r4616903468
##########
api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java:
##########
@@ -34,65 +34,126 @@
public interface BuilderProblem {
/**
- * Gets the hint about the source of the problem. While the syntax of this
hint is unspecified and depends on the
- * creator of the problem, the general expectation is that the hint
provides sufficient information to the user to
- * track the problem back to its origin. A concrete example for such a
source hint can be the file path or URL from
- * which the settings were read.
+ * Gets the hint about the source of the problem.
*
* @return the hint about the source of the problem or an empty string if
unknown, never {@code null}
*/
@Nonnull
- String getSource();
+ String source();
Review Comment:
The Javadoc for `source()` was truncated. The original `getSource()` Javadoc
explained: *"While the syntax of this hint is unspecified, it may be a file
path or URL."* (and similar context for `lineNumber()`, `columnNumber()`). The
`location()` Javadoc should read: *"Returns a user-friendly combination of the
values from `source()`, `lineNumber()`, and `columnNumber()`. The exact syntax
of the returned value is undefined."* Full documentation belongs on the noun
methods, not the deprecated bridges.
##########
api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java:
##########
@@ -80,21 +80,30 @@ default Type getType() {
* @see DependencyCoordinates#getScope()
* @deprecated Use {@link #scope()} instead.
*/
- @Deprecated(since = "4.2.0", forRemoval = true)
+ @Deprecated(since = "4.0.0", forRemoval = true)
@Nonnull
default DependencyScope getScope() {
return scope();
}
/**
* Returns whether the dependency is optional or mandatory.
- * Unlike {@link DependencyCoordinates}, the obligation of a {@code
Dependency} is always present.
- * The value is computed during the dependencies collection phase.
*
* @return {@code true} if the dependency is optional, or {@code false} if
mandatory
* @see DependencyCoordinates#optional()
*/
- boolean isOptional();
+ boolean optional();
Review Comment:
The `optional()` Javadoc dropped two important sentences from the original
`isOptional()`: *"Unlike `DependencyCoordinates`, the obligation of a
`Dependency` is always present. The value is computed during the dependencies
collection phase."* These explain why `Dependency.optional()` behaves
differently from `DependencyCoordinates.optional()` and belong on the new noun
method.
##########
api/maven-api-core/src/main/java/org/apache/maven/api/Packaging.java:
##########
@@ -74,7 +74,7 @@ public interface Packaging extends ExtensibleEnum {
*/
@Nonnull
default Language language() {
- return type().getLanguage();
+ return type().language();
Review Comment:
`type().language()` replaces the previous `type().getLanguage()`. Since
`Type.language()` is now `abstract` and `Type.getLanguage()` is a `default`
that delegates to `language()`, any external `Type` implementation compiled
against the old API (which only overrides `getLanguage()`) will throw
`AbstractMethodError` here at runtime. This is an inherent binary compatibility
cliff of the migration pattern — worth documenting in the PR description and in
a migration guide entry.
##########
api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelBuilderRequest.java:
##########
@@ -257,20 +351,20 @@ class ModelBuilderRequestBuilder {
ModelBuilderRequestBuilder() {}
ModelBuilderRequestBuilder(ModelBuilderRequest request) {
- this.session = request.getSession();
- this.trace = request.getTrace();
- this.requestType = request.getRequestType();
- this.locationTracking = request.isLocationTracking();
- this.recursive = request.isRecursive();
- this.source = request.getSource();
- this.profiles = request.getProfiles();
- this.activeProfileIds = request.getActiveProfileIds();
- this.inactiveProfileIds = request.getInactiveProfileIds();
- this.systemProperties = request.getSystemProperties();
- this.userProperties = request.getUserProperties();
- this.repositoryMerging = request.getRepositoryMerging();
- this.repositories = request.getRepositories();
- this.lifecycleBindingsInjector =
request.getLifecycleBindingsInjector();
+ this.session = request.session();
Review Comment:
The builder copy constructor now calls `request.session()`,
`request.trace()`, etc. — the new abstract noun methods. External
`ModelBuilderRequest` implementations compiled against the old API (only
overriding `getSession()`/`getTrace()`) will `AbstractMethodError` when passed
to this builder. Same binary compat cliff as `Type`/`Packaging`. Worth calling
out explicitly in the PR description.
##########
api/maven-api-core/src/main/java/org/apache/maven/api/Type.java:
##########
@@ -143,47 +142,83 @@ public interface Type extends ExtensibleEnum {
* @return the language of this type, never {@code null}.
*/
@Nonnull
- Language getLanguage();
+ Language language();
+
+ /**
+ * @return the language of this type, never {@code null}.
+ * @deprecated Use {@link #language()} instead.
+ */
+ @Deprecated(since = "4.0.0", forRemoval = true)
+ @Nonnull
+ default Language getLanguage() {
+ return language();
+ }
/**
* Get the file extension of artifacts of this type.
*
* @return the file extension, never {@code null}.
*/
@Nonnull
- String getExtension();
+ String extension();
+
+ /**
+ * @return the file extension, never {@code null}.
+ * @deprecated Use {@link #extension()} instead.
+ */
+ @Deprecated(since = "4.0.0", forRemoval = true)
+ @Nonnull
+ default String getExtension() {
+ return extension();
+ }
/**
* Get the default classifier associated to the dependency type.
- * The default classifier can be overridden when specifying
- * the {@link Dependency#getClassifier()}.
*
* @return the default classifier, or {@code null}.
*/
@Nullable
- String getClassifier();
+ String classifier();
Review Comment:
The `classifier()` Javadoc dropped: *"The default classifier can be
overridden when specifying `Dependency#getClassifier()`"* — an important
cross-reference for type authors. Similarly, `pathTypes()` lost its full
explanation of class-path vs module-path heuristics, the
`JavaPathType.CLASSES`/`MODULES` example, and the deterministic-build note.
Please restore from the original `getClassifier()`/`getPathTypes()` Javadoc.
--
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]