gnodet-bot commented on code in PR #13928:
URL: https://github.com/apache/maven/pull/13928#discussion_r4519479724
##########
impl/maven-core/src/main/java/org/apache/maven/plugin/internal/MojoExpressionEvaluationException.java:
##########
@@ -18,8 +18,12 @@
*/
package org.apache.maven.plugin.internal;
-/** Thrown when a mojo parameter expression cannot be evaluated. */
-class MojoExpressionEvaluationException extends Exception {
+/**
+ * Thrown when a mojo parameter expression cannot be evaluated.
+ *
+ * @since 4.2.0
+ */
+public class MojoExpressionEvaluationException extends Exception {
MojoExpressionEvaluationException(String message) {
Review Comment:
⚠️ The class is promoted to `public` but both constructors remain
package-private (no access modifier). External implementors of the now-public
`MojoExpressionEvaluator` SPI cannot throw `MojoExpressionEvaluationException`
from their `evaluate()` override — they cannot instantiate it. The constructors
should be `public`:
```suggestion
public MojoExpressionEvaluationException(String message) {
```
##########
impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/MojoExtension.java:
##########
@@ -841,29 +821,39 @@ public static Map<String, Object>
getVariablesAndValuesFromObject(Class<?> clazz
*/
public static void setVariableValueToObject(Object object, String
variable, Object value)
throws IllegalAccessException {
- Field field =
ReflectionUtils.getFieldByNameIncludingSuperclasses(variable,
object.getClass());
+ Field field = getFieldByNameIncludingSuperclasses(variable,
object.getClass());
requireNonNull(field, "Field " + variable + " not found");
Review Comment:
💡 `getVariableValueFromObject` includes the class name in its error message
(`"Field " + variable + " not found in " + object.getClass().getName()`), but
this one just says `"Field " + variable + " not found"`. Align them:
```suggestion
requireNonNull(field, "Field " + variable + " not found in " +
object.getClass().getName());
```
--
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]