Skip to content

I want to know what package a java class Node be in. #3907

Answered by oowekyala
XenoAmess asked this question in Q&A
Discussion options

You must be logged in to vote

ASTCompilationUnit has a method getPackageName which you can also use in XPath with the attribute @PackageName. To find the node in Java you have to get the root of the tree, by asking getParent until you find it. We have added a method getRoot to every Node in PMD 7 which we could backport to make that easier.

If that does not answer your question, please add more details about how and from where you want to get that information

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by oowekyala
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
a:question Request for information that doesn't necessarily entail changes to the code base
2 participants
Converted from issue

This discussion was converted from issue #3897 on April 11, 2022 18:23.