You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Java 11 is the target Java version for Apache Ignite 3 development. The project's Java code style is based on Google Java Style Guide. But Apache Ignite community could introduce additional rules in order to address some issues, contradictions, etc.

All rules, listed in this document, supplement or override the rules of the Google Java Style Guide.

Appendix A

1 Nullability annotation usages

These rules supplement section 4.8.5 of Google Java Style Guide.

1.1 Common annotating rules

Ignite 3 uses JetBrains nullability annotations. For the sake of code clarity it is prohibited to use @NotNull annotation, even if it compromises the completeness of static analysis. However, it is required to use @Nullable in the following places:

  • On a function's return type, if the function can return null;
  • On a function's parameter, if passing null as this parameter will not end in throwing an exception;
  • On a class field, if it can be null.

1.2 Annotating arrays

There are multiple ways to annotate a Java array, which lead to different interpretation by the static analysis tool:

@Nullable Object[] x;            // x array can *contain* null values
Object @Nullable [] x;           // x itself can be null 
@Nullable Object @Nullable [] x; // x array can contain null values *and* be null itself

1.3 Intellij IDEA settings

It is recommended to enable all inspections, related to this topic. Please note, that all nested options should also be enabled:

All these options will be set automatically, when importing inspections settings from the repository.

  • No labels