There is indeed very little documentation available.
As for the attributes: dfa = data flow analysis. Currently used by only one rule: DataflowAnomalyAnalysis.
multifile is - as Juan mentioned - is not implemented yet. The idea is, that PMD can take more than one file into account when analysis, thus having a cross-project view.
typeresolution is for Java rules enabled by default. It allows you, to retrieve the concrete Java type on some nodes, e.g. to figure out the type of a variable, you can call the method getType() on any TypeNode:
is there any document to explain typeResolution, dfa and multifile? I am not sure what they are about. Thank you.
Last edit: supermanheng21 2018-09-06
What are you looking for? How to use it in Java rules? How to build them
for other languages?
There is little documentation for these. Other than typeResolution, which
is the most mature and all doc is focused on consuming type information.
Multifile is even disabled at the moment, as it's incomplete / incompatible
with other PMD features such as incremental analysis.
On Thu, Sep 6, 2018 at 3:36 AM supermanheng21 supermanheng21@users.sourceforge.net wrote:
I am looking for how to use them, and in fact, I don't even konw what they are and why use them.
There is indeed very little documentation available.
As for the attributes: dfa = data flow analysis. Currently used by only one rule: DataflowAnomalyAnalysis.
multifile is - as Juan mentioned - is not implemented yet. The idea is, that PMD can take more than one file into account when analysis, thus having a cross-project view.
typeresolution is for Java rules enabled by default. It allows you, to retrieve the concrete Java type on some nodes, e.g. to figure out the type of a variable, you can call the method
getType()
on any TypeNode:So, you could restrict the rule to only look for e.g. "java.lang.String" or any other specific type.
More info can be found here: https://pmd.github.io/pmd-6.7.0/pmd_userdocs_extending_writing_pmd_rules.html
Especially the section about "I need some kind of Type Resolution for my rule!"
Thank you for your detailed explanation.