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
Null pointer exception with records in RequireThisCheck #11807
Comments
Regression never caught this? |
How did we find it now? Did we create this class ourselves? |
@rnveach see #11805 (comment), I have created a new projects file at checkstyle/contribution#613 |
rnveach
added a commit
to rnveach/checkstyle
that referenced
this issue
Nov 29, 2022
rnveach
added a commit
to rnveach/checkstyle
that referenced
this issue
Nov 29, 2022
rnveach
added a commit
to rnveach/checkstyle
that referenced
this issue
Dec 2, 2022
rnveach
added a commit
to rnveach/checkstyle
that referenced
this issue
Dec 2, 2022
rnveach
added a commit
to rnveach/checkstyle
that referenced
this issue
Dec 2, 2022
rnveach
added a commit
to rnveach/checkstyle
that referenced
this issue
Dec 2, 2022
romani
pushed a commit
that referenced
this issue
Dec 3, 2022
Fix was merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have read check documentation: https://checkstyle.sourceforge.io/config_coding.html#RequireThis
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
This was discovered at #11805 (comment).
Relevant AST-
Reason:
The main reason for this happening is due to the fact that record instance members (record components) don't have any modifier (they are implicitly
private
andfinal
). AST does not show anyTokenTypes.MODIFIERS
for record components (which is correct) and the condition atcheckstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java
Lines 1529 to 1540 in b87a6c0
TokenTypes.MODIFIERS
so we get an NPE.The text was updated successfully, but these errors were encountered: