Are you tired of null pointer exceptions, unwanted side effects, SQL injections, broken regular expressions, concurrency errors, mistaken equality tests, and other runtime errors that appear during testing or in the field? Do you wonder why every production code base needs its own implementation of money and currency types, physical units, or string processing? Aren’t all these simply indicators for missing features in Java’s typesystem? Turns out they are. And even better: Annotation processing to the rescue - there is a standardized way to fix it! Annotation processors allow to tweak and enhance the Java compiler. Especially with Java8 type annotations, they offer means to improve the typesystem and detect many of the problems at compile-time that would usually only surface at runtime.
In this session, I want to introduce the Checker Framework (https://checkerframework.org/). It offers plenty of sensible annotations which greatly enhance Java's type system to make it more powerful and useful. The framework lets software developers detect and prevent errors in their Java programs at compile time independently from the used IDE, compiler or build tool. This helps to find bugs or verify their absence. Out of the box, it ships with checkers for various bug patterns in the area of:
- Null safety
- Map and collection access
- Concurrency and lock semantics
- Regular expressions
- Format strings and i18n
- UI effects and thread affinity
- Reflective code
There are many more, and it’s even possible to implement custom checkers tailored to project specific requirements and coding habits.
If you want to learn about advanced use cases for Java annotations and detect bugs while you code, come to this session and get a jumpstart about the Checker Framework.