Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 1.19 KB

null-handling.md

File metadata and controls

28 lines (19 loc) · 1.19 KB

⇧ Platform Base

Handling of null values

In the code we should annotate all parameters of methods and constructors with the @Nullable or @NonNull annotations. Next to this all methods that define a return value should be annotated by one of the 2 annotations. This is done to make the code more readable and to avoid null pointer exceptions.

Null annotations

We use edu.umd.cs.findbugs.annotations.Nullable and edu.umd.cs.findbugs.annotations.NonNull annotations. Maybe we will create our own annotations in the future but for now only the 2 annotations from the findbugs library must be used. This has been decided based on an analysis of the most used annotations in the open source community (hashgraph#4234).

IntelliJ IDEA support

In IntelliJ IDEA you can enable the null annotations support by activating the @Notnull/@Nullable problemsInspections. Next to this the Configure Annotations button in the compiler section of the settings let you define exactly the 2 given annotations.

Java Module

The module-info.java file should contain the following line:

requires static edu.umd.cs.findbugs.annotations;