GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — [kotlin] Suppress empty-list attribute values in tree dump tests by stokpop · Pull Request #7165 · pmd/pmd Conversation
|
|
No relevant source code has been changed, pmdtester skipped. (comment created at 2026-10-27 10:46:36+00:00 for 6100f6c) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Actually, I wouldn't remove these attributes, if they are empty. The fact, that these attributes exist, but have no value, is still important. The initial reason, why this PR was created, was: clutter in tree dump. And this can be solved, by just not outputting these attributes in tree dumps. I still find it valueable, if all possible attributes are listed in the designer - this helps to explore and understand the AST. If the AST has already too many attributes that it is overwhelming, then we can enhance the designer: It already has a button to "Hide common attributes":
We could add a second button to "Hide empty attributes" - but only, if empty attributes are really a problem.
I'll update the PR to just change the tree dump behavior in Kotlin and leave the attributes as is. Then we also don't need to reason about compatibility with existing XPath rules.
Note: That we skip null-valued attributes, is maybe something we should rethink: Ideally, we would only skip attributes, that we defined explicitly to be optional and not every attribute whose value happen to be null.
Skipping attributes also might result in bad design: If you know, that empty attributes will be skipped, then you could add the attribute to every node by default - since it will only show up, if it has a value. I'd rather be explicit which node supports which attributes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The attributes still exist and are not removed.
There was an error while loading. Please reload this page.
|
Thanks for merging @adangel . I agree that it is better to have all attributes visible in the designer so you know what is available on what nodes/levels. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.