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

[ENHANCEMENT] Add JetBrains Annotations #731

Open
FisherLuba opened this issue Feb 12, 2024 · 0 comments
Open

[ENHANCEMENT] Add JetBrains Annotations #731

FisherLuba opened this issue Feb 12, 2024 · 0 comments
Labels
documentation enhancement Improvement to existing feature wiki Changes involving the Wiki

Comments

@FisherLuba
Copy link
Collaborator

Describe the current behavior of what you're trying to improve. If your enhancement request related to a problem, please also describe the problem.

It can be hard to tell what objects can be null and what shouldn't be.

Describe the improvement you'd like

I think adding JetBrains Annotations could be helpful to make some things in the code more clear. Some nice ones are @Nullable, @NotNull, and @Contract, especially for classes that are meant to be used in more than just one puzzle. @Contract can be used to specify whether a method is pure and whether it mutates method parameters, along with describing other behaviors of a method. Another benefit is that IntelliJ can generate warnings based on the annotations, for example if you pass a nullable object to a method parameter marked @NotNull without checking if it's null first.

Using both @Nullable and @NotNull isn't necessary, if this request is approved I think one or the other should be used and added to the developer guidelines. I think using @Nullable and assuming @NotNull is good, but either way works.

Describe alternatives you've considered

Commenting code is another way to show what can be null and describe method behaviors, but I think annotations are more clear and they can also generate warnings in IntelliJ.

Additional Context

This wouldn't change any behavior of the code, it would just add some nice documentation and help prevent errors and bugs.

@FisherLuba FisherLuba added enhancement Improvement to existing feature documentation wiki Changes involving the Wiki labels Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement Improvement to existing feature wiki Changes involving the Wiki
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant