GeezerVison is showing github.com — [core] Deprecate support for List attributes with XPath 2.0 · Issue #2451 · pmd/pmd
[core] Deprecate support for List attributes with XPath 2.0 #2451Labels in:xpathRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolutionis:deprecationThe main focus is deprecating public APIs or rules, eg to make them internal, or removing them DescriptionPart of #2523
When we update Saxon on PMD 7, attributes of type List (List<String>) won't work anymore, since with newer Saxon versions, attributes are supposed to be always non-sequences.
That's why we should deprecate the usage of such attributes for XPath (via @DeprecatedAttribute).
Affects PMD Version: 6.x + 7
Affected Attributes:
I grepped our code (find -wholename "*/lang/*/ast/*.java"|grep -i -v test|grep -v generated-sources | xargs grep "List<") and found only these usages:
./pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java:51: public List<String> getNames() {
./pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTUserTrigger.java:41: public List<TriggerUsage> getUsages() {
./pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTFieldDeclarationStatements.java:62: public List<String> getTypeArguments() {
All are in Apex and could be potentially used by some XPath 2.0 rule. (TriggerUsage is a enum). I didn't find any usage of these getters/attributes in our apex rules.
Note
- This is a requirement for PMD 7, so that we can update Saxon
- It only affects XPath 2.0 rules, for Jaxen, we already filter out Lists (see
net.sourceforge.pmd.lang.ast.xpath.DocumentNavigator.ListFilteringAttributeIterator).
- Not sure, whether we really need to provide an alternative right now to make Lists accessible in XPath. I'd rather wait until we have a concrete use case before we start inventing something.
- This also relates to List properties ([core] Make Saxon support multi valued XPath properties #736). I didn't investigate yet, what the consequences are.
Proposed Steps:
- Deprecate the three apex getters for XPath
- Update documentation, if any. Maybe fix xpath example queries.
- Mention this in the release notes
Activityadded a:RFCA drafted proposal on changes to PMD, up for feedback form the team and community in:xpathRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolution on Apr 27, 2020oowekyala commented on Apr 27, 2020 removed a:RFCA drafted proposal on changes to PMD, up for feedback form the team and community on May 23, 2020changed the title [-][core] XPath and Lists[/-] [+][core] Deprecate XPath 2.0 supports for List attributes[/+] on Jun 20, 2020changed the title [-][core] Deprecate XPath 2.0 supports for List attributes[/-] [+][core] Deprecate support for List attributes with XPath 2.0[/+] on Jun 20, 2020added a commit that references this issue on Jun 20, 2020This issue will close once commit 9c48ad1 is merged into the 'main' branch.9c48ad1
MetadataMetadatain:xpathRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolutionis:deprecationThe main focus is deprecating public APIs or rules, eg to make them internal, or removing them DevelopmentNo branches or pull requestsIssue actions
|