feat: use lombok to generate java files #240
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Configuration.builder()and atoStringmethod on the builder and configuration object.Configuration.javaandlib.rsWith that I'd like to know whether the breaking change above mentioned is acceptable or if anything needs to be further adjusted.
Generated class preview
Copilot PR review summary
Summary of PR #240: "feat: use lombok to generate java files"
This PR migrates the Java code generation for the minify-html project from a custom JavaScript script to using Lombok, a popular Java annotation processor that reduces boilerplate code.
Configurationclass, making the codebase more maintainable.toString()are added for the builder and configuration.Configuration.javaandlib.rs.The PR author specifically asks whether the breaking change in field names (from snake_case to camelCase) is acceptable or if further adjustment is needed.
Code Review
Positive Aspects
Using Lombok removes a significant amount of boilerplate, especially for immutable value objects and builders.
The new bash script (
update-java.sh) is clear and leverages source markers, which helps automate updates as the Rust config changes.Basic tests are added, including not only a positive case but also null parameter validation.
The change from public final fields to Lombok-generated values and the move to camelCase fields encourages correct encapsulation and more idiomatic Java usage.
Dependency and plugin versions are updated, which is important for compatibility and security.
Points of Attention / Suggestions
Configurationfields from snake_case to camelCase is a breaking change for anyone who accessed fields directly rather than via the builder. This is called out in the PR and is generally safe if the fields weren't meant for direct access. However, it should ideally be highlighted in release notes and the documentation.@Valueand@Builder, the fields become private and final, which is good. Ensure that the generated getters follow JavaBean conventions (they do, by default).getAllowNoncompliantUnquotedAttributeValues). This is correct and maintains the bridge.Conclusion
This PR is a strong improvement for maintainability and modernization of the Java API in minify-html. The one major breaking change (field naming) is well-documented and justified, but it should be communicated clearly to any library consumers. No significant issues found in the implementation—good use of Lombok, careful updates to interop, and improved project hygiene.
Open Todos