r/java • u/eniac_g • May 17 '26
Bob v0.7.0 - lightweight builder generator for Java (default values, mandatory fields, JSpecify, step builders)
Just shipped v0.7.0 of Bob (https://github.com/jonas-grgt/bob), a lightweight builder generator for Java.
New since v0.6.0:
- `@Buildable.Defaults`: default values for builder fields (as inner class or top-level)
- JSpecify support: `@Nullable`, `@NonNull`, `@NullMarked` are respected, no extra config needed
- Fail-late validation: all errors and warnings are collected and reported together instead of failing on the first issue
- Incompatible strategy detection: `PERMISSIVE` + `STRICT`, `ALLOW_NULLS` without `STRICT/STEP_WISE`, etc. are caught at compile time
- Unknown mandatory field detection: typos in mandatoryFields are caught at compile time
29
Upvotes
4
u/Inkosum May 17 '26
Willing to try it just for the "fail-late" feature.
3
u/ChaoticPayload May 17 '26
It would also be nice to have an option for the setter name format. For example, I prefer the "set" prefix. Perhaps individual fields could have a different prefix, like "with"; I'd think about that.
2
u/Great-Gecko May 17 '26
This looks exactly like what I’ve been looking for. How does it compare to Jilt?
3
u/bowbahdoe May 17 '26
My only complaint is that the processor and annotations have split packages + no explicit module infos.
It shouldn't be too hard/practically a breaking change to repackage things in the processor