[java] Updates to AST nodes#4768
Conversation
Only on ASTMethodDeclaration, ASTFieldDeclaration and ASTAnyTypeDeclaration. This makes it possible to remove it from AccessNode.
Deprecate ASTClassOrInterfaceDeclaration#isPackagePrivate(). Use #hasVisibility(Visibility) instead, which can correctly differentiate between local and package private classes.
Generated by 🚫 Danger |
|
Thanks for starting this! I would also suggest renaming VariableDeclaratorId to VariableId since it's used relatively often in the codebase. |
a3a19eb to
e79e840
Compare
|
I guess, we should also rename ASTClassOrInterfaceBody to ASTClassBody. It looks odd, if we leave ASTClassOrInterfaceBody... (it's the only one with "ClassOrInterface") |
Also rename AbstractAnyTypeDeclaration to AbstractTypeDeclaration
…ration Also rename AbstractMethodOrConstructorDeclaration to AbstractExecutableDeclaration
- getName() instead of getMethodName() or getVariableName() - firstChild() instead of getFirstChildOfType() - getRoot() instead of getFirstParentOfType(ASTCompilationUnit.class) - children() instead of findChildrenOfType() - no more addRuleChainVisit() - ancestors() instead of getNthParent() - descendants() instead of findDescendantsOfType()
- firstChild() instead of getFirstChildOfType() - descendants() instead of findDescendantsOfType() - ancestors() instead of getFirstParentOfType()
- This improves ASTLiteral implementation - Adds ASTLiteral#getLiteralText() - not yet exposed as XPath attribute Co-authored-by: Clément Fournier <clement.fournier76@gmail.com>
- taken from pmd#4352 (avoid getImage()) - Exposes @LiteralText for ASTLiteral Co-authored-by: Clément Fournier <clement.fournier76@gmail.com>
|
I think, this is ready now. Many deprecated API usages are resolved. I integrated parts of #4352 (ASTLiteral improvements, XPath Attribute improvements).
Deleting deprecations needs to be done in a separate PR (I don't want to make this even bigger).
|
…nal/PrettyPrintingUtil.java Co-authored-by: Clément Fournier <clement.fournier@tu-dresden.de>
Describe the PR
Finish the remaining open tasks for Java (#1307, #3751).
Note: I don't want to remove any methods for now, just deprecate them, if not already. I think, we should remove the deprecated methods only after a RC5, to have some deprecation notice. However, renaming classes definitely breaks...Not sure, if it's worth to wait. I'll see, once I proceed with this PR.
In this case, I decided now to remove the method ASTClassDeclaration#isPackagePrivate since we renamed the class from ASTClassOrInterfaceDeclaration. So, deprecating isn't that helpful.
Tasks:
Long.parseUnsignedLongrather than a custom implementation.@LiteralTextis availableRelated issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)