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

FinalClassCheck: 'extractQualifiedName' omits 2nd ident of package name #5706

Closed
rnveach opened this issue Apr 10, 2018 · 8 comments
Closed
Milestone

Comments

@rnveach
Copy link
Member

rnveach commented Apr 10, 2018

When debugging tests like testFinalClass, extractQualifiedName returns com.tools.checkstyle.checks.design.finalclass when the package is clearly defined as com.puppycrawl.tools.checkstyle.checks.design.finalclass (puppycrawl is missing).

Looking at the code, when it gets to the top node of the package name, it only pulls in the first IDENT and not them both.

I am not sure if this bug presents itself in the CLI somehow as I am not that familiar with the check.
I found this bug by duplicating the same code in my own custom check.

@rnveach
Copy link
Member Author

rnveach commented Apr 10, 2018

@romani Don't we have FullIdent(https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java) class to be used in this type of situation?
Should this method just be removed and we use FullIdent instead? I assume it doesn't have this same bug. Confirmed FullIdent works correctly.

@romani
Copy link
Member

romani commented Apr 10, 2018

I am ok to re-use FullIdent, but one day it will not be API :) class.

@rnveach
Copy link
Member Author

rnveach commented Apr 10, 2018

I'm not sure what you mean, API versus util doesn't matter for checks.

@romani
Copy link
Member

romani commented Apr 10, 2018

src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java

Check is ok to reuse this class at any package.

@rnveach
Copy link
Member Author

rnveach commented Apr 10, 2018

yes, I know you meant the API package.
But I don't understand from your 1st comment why importing an API class versus a non-API class matters for a check. If FullIdent moves to util package, it won't hurt this check or any check using it.

@rnveach
Copy link
Member Author

rnveach commented Apr 10, 2018

If you are referring to my custom check, anyone outside checkstyle can use utils if that is where you plan to move FullIdent to. It is used by so many checks that the constructor can't be private/protected.

rnveach added a commit to rnveach/checkstyle that referenced this issue Apr 10, 2018
@romani
Copy link
Member

romani commented Apr 10, 2018

it was just side note(off topic) for future of FullIdent class.

@rnveach
Copy link
Member Author

rnveach commented Apr 11, 2018

Fix was merged

@rnveach rnveach closed this as completed Apr 11, 2018
@rnveach rnveach added this to the 8.10 milestone Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants