Skip to content
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

Merged
merged 1 commit into from
Nov 24, 2022

Conversation

rnveach
Copy link
Member

@rnveach rnveach commented May 8, 2022

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.

package com.puppycrawl.tools.checkstyle.api;

/** Base interface used for all ASTs of Checkstyle. */
public interface CheckstyleAST {
Copy link
Member Author

@rnveach rnveach May 8, 2022

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.

Copy link
Member

@nrmancuso nrmancuso May 8, 2022

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no complaints.

@rnveach
Copy link
Member Author

rnveach commented May 8, 2022

CI is expected to fail since it references the issue which has not been approved.

@rnveach
Copy link
Member Author

rnveach commented May 15, 2022

@nick-mancuso Let me know if there is anything else. I renamed the one class.

Copy link
Member

@nrmancuso nrmancuso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Items:

@nrmancuso nrmancuso assigned romani and unassigned nrmancuso May 17, 2022
@rnveach
Copy link
Member Author

rnveach commented May 25, 2022

@romani You have any thoughts on this PR?

@romani romani requested review from pbludov and strkkk June 6, 2022 00:36
Copy link
Member

@romani romani left a 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

Copy link
Member

@pbludov pbludov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix Javadoc

@rnveach
Copy link
Member Author

rnveach commented Jul 1, 2022

@romani ping

@rnveach rnveach force-pushed the issue_11604_3 branch 2 times, most recently from 4631083 to 4b6cc86 Compare August 4, 2022 01:38
@rnveach rnveach force-pushed the issue_11604_3 branch 3 times, most recently from a0c22d9 to 7a13a77 Compare August 30, 2022 00:49
@romani
Copy link
Member

romani commented Sep 25, 2022

Github, rebase

@romani
Copy link
Member

romani commented Nov 5, 2022

@rnveach , please rebase

@rnveach
Copy link
Member Author

rnveach commented Nov 5, 2022

Done.

@romani
Copy link
Member

romani commented Nov 20, 2022

@rnveach , please resolve conflict and change commit message to reference PR not a umbrella issue.

rnveach added a commit to rnveach/checkstyle that referenced this pull request Nov 20, 2022
rnveach added a commit to rnveach/checkstyle that referenced this pull request Nov 20, 2022
@romani
Copy link
Member

romani commented Nov 20, 2022

I don't see any bad casting. If no objections, let's squash commits.

rnveach added a commit to rnveach/checkstyle that referenced this pull request Nov 20, 2022
@rnveach
Copy link
Member Author

rnveach commented Nov 20, 2022

Squashed.

I don't see any bad casting

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.

@rnveach

This comment was marked as outdated.

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last:

config/import-control.xml Outdated Show resolved Hide resolved
rnveach added a commit to rnveach/checkstyle that referenced this pull request Nov 23, 2022
Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Items

config/import-control.xml Show resolved Hide resolved
rnveach added a commit to rnveach/checkstyle that referenced this pull request Nov 24, 2022
Copy link
Member

@romani romani left a 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

@romani romani merged commit 5e413ff into checkstyle:master Nov 24, 2022
@rnveach rnveach deleted the issue_11604_3 branch November 24, 2022 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants