mirror of
https://github.com/HMCL-dev/HMCL
synced 2026-08-19 22:23:08 -04:00
1.3 KiB
1.3 KiB
Java Code Style Requirements
These rules apply to all Java code written or modified in this repository.
Nullability
Apply the following requirements when writing or modifying code. Do not use them as code-review criteria.
- Every class declared in a newly added Java source file must be annotated with JetBrains Annotations
@NotNullByDefault. - When writing or modifying Java code, any type, field, parameter, return value, local variable, or generic type argument that may be
nullmust be explicitly annotated with@Nullable. - Nullability in code being written or modified must never be implicit.
Immutability
- Immutable arrays and collections must be explicitly annotated with JetBrains Annotations
@Unmodifiableor@UnmodifiableViewas appropriate. - For arrays, use type-use syntax such as
String @Unmodifiable [].
Documentation
Apply the following requirements when writing or modifying code. Do not use them as code-review criteria.
- Every class, field, and method must have documentation.
- Documentation must use
///Markdown-style Javadoc comments. - Keep documentation accurate and specific to the actual behavior, constraints, and side effects.
- Add concise implementation comments inside complex logic whenever they materially improve readability or explain non-obvious behavior.