Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API/Core: Make ScanReport and its related classes Immutable
* Use true immutable objects that are type-safe, thread-safe, null-safe * Get builder classes for free This is relying on https://immutables.github.io/ (Apache License 2.0), which allows generating immutable objects and builders via annotation processing. * Immutable objects are serialization ready (including JSON and its binary forms) * Supports lazy, derived and optional attributes * Immutable objects are constructed once, in a consistent state, and can be safely shared * Will fail if mandatory attributes are missing * Cannot be sneakily modified when passed to other code * Immutable objects are naturally thread-safe and can therefore be safely shared among threads * No excessive copying * No excessive synchronization * Object definitions are pleasant to write and read * No boilerplate setter and getters * No ugly IDE-generated hashCode, equals and toString methods that end up being stored in source control. Note that we are specifically preventing people from using Jackson-related annotations (`@JsonSerialize` & `@JsonDeserialize`) in order to avoid potential runtime library dependency issues where a clashing jackson lib would prevent jackson-related annotations to be used/processed.
- Loading branch information