-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add Check Support for Java 17 Sealed Classes: AnnotationOnSameLine #15074
Comments
@mahfouz72 I am not seeing a compile check that this is valid syntax.
https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassPermits If this was allowed, why would someone put an annotation on a permits? |
sorry this won't compile IntelliJ didn't show an error on this line and I forgot to check Javac. First post is updated |
Is it possible for annotations to be before |
it is possible and I think it works correctly please check first post |
I am not sure about this part.
EDIT: I tried to use a public modifier instead of sealed to see how the check deals with this case and the behavior is similar.
|
https://checkstyle.org/checks/annotation/annotationonsameline.html#Description
If If the following isn't a violation, then this seems like a bug, but unrelated to sealed classes.
You don't use most of these like constructor or field. I would trim these down to the bare minimum and confirm just so we aren't making some type of mistake here on what the "target" is. |
@mahfouz72 I see updates were done, please remember to ping me back so I can remember to come back here and view. So much is going on that I rely on notifications a lot more now.
Did you confirm this? |
Yes, this bug is unrelated to the sealed class it exists with any modifier. When the Anno is on the same line with the target class modifier but not on the same line with the target class itself
@rnveach I guess we should close this and open a new issue with this code because this is not related to sealed directly |
I agree. I feel we can just repurpose this existing issue by updating the title and first post. I am not against just creating a new issue. |
@rnveach I updated title and first post please approve if you are good |
@mahfouz72 please make a new issue as @rnveach suggested |
This can be closed no update is needed related to sealed classes. The discoverd (unrelated to sealed classes) bug has been moved to a new issue #15161 |
child of #14969
Check documentation : https://checkstyle.org/checks/annotation/annotationonsameline.html#AnnotationOnSameLine
This check working correctly no update is needed.
Note that annotations are not acceptable after permits
The text was updated successfully, but these errors were encountered: