Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Table of Contents

Appendix A: Code Style

1 Formatting

1.1 Block indentation: +4 spaces

...

Java code has a column limit of 140 characters.

1.3 Horizontal alignment is disallowed.

This rule overrides section 4.6.3 of Google Java Style Guide.

Alignment can aid readability, but it creates problems for future maintenance. So horizontal alignment is disallowed.

2 Nullability annotation usages

...

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

...

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

...

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

...

Code Block
languagejava
var i = Integer.parseInt("42");
var s = "Hello".substring(0, 3);
var list = Arrays.asList(1, 2, 3);        
var map = getMapping(); // some method invocation
var val = map.get(42);


Appendix B: Practices

1 Using Stream API

Historically Apache Ignite developers try to avoid redundant Java object instantiations due to the additional GC pressure. Of course, escape analysis exists but we can't trust this feature and should keep objects instantiation under control where it is possible and justified.

So it is recommended to avoid usage of Stream API at least on the hot code path.

2 Using 3rd party libraries

Using of 3rd party libraries in production code is prohibited. But there are some exceptions to this rule:

  • JUnit for test
  • Netty
  • ScaleCube