-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #11604: separates detail ast from xpath #11617
Conversation
package com.puppycrawl.tools.checkstyle.api; | ||
|
||
/** Base interface used for all ASTs of Checkstyle. */ | ||
public interface CheckstyleAST { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XPath knows about the underlying AST (see getUnderlyingNode
), so to be able to provide this method without just using Object
this class was created and all ASTs implement it.
I was originally planning for this to be just AST
but PMD complained it was too short. I am open to other names or if this should be named Node
. (Are all our ASTs, ASTs, or are they Nodes, or are they....)
Right now it is completely empty, but it will have a future purpose for other common areas that fully rely on the specific ASTs provided. The next target area will be the AstTreeStringPrinter
and making the code agnostic that it doesn't care what AST is given to it.
Future planned methods here will be: print (possibly), get line, get column, get type. Some of this when it comes will be breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to not do Checkstyle
,what about AbstractSyntaxTree
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no complaints.
CI is expected to fail since it references the issue which has not been approved. |
@nick-mancuso Let me know if there is anything else. I renamed the one class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Items:
src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java
Show resolved
Hide resolved
src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractSyntaxTree.java
Outdated
Show resolved
Hide resolved
@romani You have any thoughts on this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let me block it to think twice on API changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix Javadoc
src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java
Outdated
Show resolved
Hide resolved
@romani ping |
4631083
to
4b6cc86
Compare
a0c22d9
to
7a13a77
Compare
Github, rebase |
7a13a77
to
db6b7ee
Compare
@rnveach , please rebase |
40a3abb
to
6011777
Compare
Done. |
6011777
to
990544d
Compare
@rnveach , please resolve conflict and change commit message to reference PR not a umbrella issue. |
990544d
to
d714807
Compare
d714807
to
c692c68
Compare
I don't see any bad casting. If no objections, let's squash commits. |
c692c68
to
09b02aa
Compare
Squashed.
Casting is already in place because the new interface didn't have any methods, so everything needed to be casted to the actual class anyways. |
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last:
src/main/java/com/puppycrawl/tools/checkstyle/xpath/RootNode.java
Outdated
Show resolved
Hide resolved
09b02aa
to
0deaaa2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Items
0deaaa2
to
f06eacc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok to merge after squash
ab9a45b
to
0b26308
Compare
Issue #11604
This separates DetailAST from xpath so that more of its base classes can be expanded upon and make use of xpath for other ASTs without re-inventing everything. Not much was changed besides splitting the classes in half.
Import control was added to enforce this in the future.