-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[core] Make boolean XPath attributes accessible with their prefix #1170
Copy link
Copy link
Open
Labels
a:RFCA drafted proposal on changes to PMD, up for feedback form the team and communityA drafted proposal on changes to PMD, up for feedback form the team and communityin:xpathRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolutionRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolution
Milestone
Metadata
Metadata
Assignees
Labels
a:RFCA drafted proposal on changes to PMD, up for feedback form the team and communityA drafted proposal on changes to PMD, up for feedback form the team and communityin:xpathRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolutionRelating to xpath support at large, eg Jaxen / Saxon, custom functions, attribute resolution
Type
Fields
Give feedbackNo fields configured for issues without a type.
Boolean attributes in XPath are stripped of their
is,hasorusesprefix, although it greatly contributes to readability:http://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AttributeAxisIterator.java#L36-L44
SwitchStatement[@IsDefault = true()]would be much more readable than just@Default = true(), and same for eg@IsArrayfor dimensionable nodes. The problem is even greater withhas, since it's common practice to eg have ahasXXandgetXXon the same class, which would be truncated to the same attribute name. If we're going to flesh our the AST APIs, we need to avoid that.It would be great to preserve the prefix on boolean attributes. The problem here is compatibility, so we would have to keep the two forms along for some time, one being deprecated.
The new behaviour needs to be described in the language specific doc (it's part of the AST API).