gnodet commented on code in PR #1983:
URL: https://github.com/apache/maven-resolver/pull/1983#discussion_r3794815442


##########
maven-resolver-tools/src/main/java/org/eclipse/aether/tools/ConfigurationCollectorDoclet.java:
##########
@@ -584,81 +700,198 @@ protected String defaultAction(DocTree node, Void p) {
         }
     }
 
-    private String escapeHtml(String text) {
-        return text.replace("&", "&amp;").replace("<", "&lt;").replace(">", 
"&gt;");
+    private static String escape(RenderMode mode, String text) {
+        if (mode == RenderMode.HTML) {
+            return text.replace("&", "&amp;").replace("<", 
"&lt;").replace(">", "&gt;");
+        } else {
+            return text;
+        }
     }
 
-    private String getSince(TypeElement type, DocCommentTree docComment, 
VariableElement fieldContext) {
-        String since = getSinceTag(docComment, fieldContext);
-        if (since == null && type != null) {
+    private Optional<String> getSince(DocTreePath path) {
+        String since = getSinceTag(path);
+        if (since == null) {
             // fall back to the enclosing type's @since
-            since = getSinceTag(docTrees.getDocCommentTree(type), null);
+            DocTreePath parentPath = path.getParentPath();
+            if (parentPath != null) {
+                return getSince(parentPath);

Review Comment:
   The `getSince` fallback to the enclosing type's `@since` tag may no longer 
work correctly. The old code explicitly called 
`docTrees.getDocCommentTree(type)` to look up the TYPE's doc comment when a 
field lacked its own `@since` tag. The refactored code recurses via 
`DocTreePath.getParentPath()`, but `rootPath` (constructed at the top of the 
processing loop) is a root `DocTreePath` whose `getParentPath()` returns `null` 
per JDK API contract, so this fallback branch never executes.
   
   This would affect configuration key classes where fields inherit `@since` 
from the enclosing type — for example, `GnupgConfigurationKeys` has `@since 
2.0.0` on the class with 5 config fields that have no field-level `@since`, and 
`ConfigurationProperties` has many more such fields. These fields would produce 
empty `since` values in the generated documentation.
   
   Worth verifying that the generated output still includes `since` values for 
inherited cases.



-- 
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