GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

New issue
Copy link
New issue
Copy link
Closed
#2609
Closed
[core] Deprecate support for List attributes with XPath 2.0#2451
#2609
Copy link
Assignees
adangel
Labels
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
Milestone
6.25.0

Description

@adangel
adangel
opened on Apr 27, 2020
Issue body actions

Part 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

Activity

  1. adangel
    added
    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, 2020
  2. adangel
    added this to the 6.24.0 milestone on Apr 27, 2020
  3. oowekyala commented on Apr 27, 2020

    @oowekyala
    oowekyala
    on Apr 27, 2020
    Member
    More actions

    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.

    I agree with that. If those are useful in XPath there there's always the possibility to add a custom function. So instead of writing @TypeArguments you'd write eg pmd-apex:typeArguments()

    This also relates to List properties (#736). I didn't investigate yet, what the consequences are.

    Apparently this still works, I added a test for it:

    http://github.com/oowekyala/pmd/blob/4fb56bf32c7fe25b44592659642e5ab1cd6dfb54/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java#L52-L60

  4. adangel
    removed
    a:RFCA drafted proposal on changes to PMD, up for feedback form the team and community
    on May 23, 2020
  5. adangel
    modified the milestones: 6.24.0, 6.25.0 on May 23, 2020
  6. adangel
    self-assigned this
    on Jun 20, 2020
  7. adangel
    added
    is:deprecationThe main focus is deprecating public APIs or rules, eg to make them internal, or removing them
    on Jun 20, 2020
  8. adangel
    changed the title [-][core] XPath and Lists[/-] [+][core] Deprecate XPath 2.0 supports for List attributes[/+] on Jun 20, 2020
  9. adangel
    changed the title [-][core] Deprecate XPath 2.0 supports for List attributes[/-] [+][core] Deprecate support for List attributes with XPath 2.0[/+] on Jun 20, 2020
  10. adangel
    added a commit that references this issue on Jun 20, 2020

    [core] Deprecate support for List attributes with XPath 2.0

    This issue will close once commit 9c48ad1 is merged into the 'main' branch.
    9c48ad1
  11. adangel
    added
    has:pr
    on Jun 20, 2020
  12. adangel
    closed this as completedin 9c48ad1on Jun 26, 2020
  13. adangel
    closed this as completedin #2609on Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @adangel
    adangel

Labels

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

Type

No type

Projects

No projects

    Milestone

    • 6.25.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.