-
Notifications
You must be signed in to change notification settings - Fork 145
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 #461: Field single declaration check implemented #811
base: master
Are you sure you want to change the base?
Issue #461: Field single declaration check implemented #811
Conversation
final DetailAST findFirstToken = ast.findFirstToken(TokenTypes.TYPE); | ||
final FullIdent ident = CheckUtil.createFullType(findFirstToken); |
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.
Not sure if we should test findFirstToken
and ident
against NPE. A variable definition should always have a TYPE and IDENT right ?
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.
Regression would should if an exception is possible.
7e6921b
to
7cd43be
Compare
7cd43be
to
e66589d
Compare
Unfortunately, i was not able to fix the build of
Any hint ? |
A PR to contribution report has to be made to add the check. It can only be merged after this PR is merged, so as long as it is the only error, it is fine for it to stay. |
public void visitToken(DetailAST ast) { | ||
if (SevntuUtil.matchesFullyQualifiedName(ast, fullyQualifiedClassName)) { | ||
if (hasPreviouslySeenClass) { | ||
log(ast.getLineNo(), MSG_KEY, fullyQualifiedClassName); |
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 give it the full AST.
|
||
@Override | ||
public int[] getDefaultTokens() { | ||
return new int[] {TokenTypes.VARIABLE_DEF }; |
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 don't see this being enough. You are not checking imports so your implementation is very susceptible to name conflicts.
@yaziza ping |
#461