Building high quality software systems is what pow...
# platform-toolbox
j
Building high quality software systems is what powers Picnic’s mission to revolutionize online groceries. In this post, Rick shows how we empower our Java developers using
Error Prone
, an extensible static analysis tool for Java code. What does this bring us? Catching more bugs, ensuring we have a consistent codebase, but moreover enabling us to execute large-scale automated refactorings! In fact, Picnic loves
Error Prone
so much we heavily invested in
Error Prone Support
, a new library that extends the usefulness of Error Prone itself. https://medium.com/@rick.ossendrijver/b8a566be6886 Want to see it in action? Join us next week @ Devoxx (Belgium), or the week after @ Java One (SF)! We’ll demo the tooling, explain in-depth how we use it at Picnic, and share the future of
Error Prone Support
.
i
Nice read, thanks for sharing!
j
This is now also open source 🎉 https://blog.picnic.nl/picnic-open-sources-error-prone-support-b23f9a7208b6 Here’s also a video by my colleague who goes into depth of using Error Prone (Google) and Error Prone Support (Picnic) in a Java codebase

https://www.youtube.com/watch?v=B-GaOGuXvwA

r
I worked some years ago in walkmod, another OSS tool for java refactoring but I could no longer maintain it. I love to see these tools 🙂
j
Oh that looks pretty awesome too! Are you combining other tools or did you write it from scratch?
Feedback is appreciated! And of course, issues or PRs are always welcome ❤️
r
I did write it from scratch 🙂
Sure, I would like to explore as a side project if I can infer the required transformations from git changes. Let's see how far I go
j
@Raquel Pau Fernandez That would be awesome! Bug checks are little bit more involved, as you need to work with the AST. But refaster templates are super easy to write, as you simply write Java code with a before and after template. For example:
Copy code
@BeforeTemplate
boolean before(Instant a, Instant b) {
    return a.compareTo(b) < 0;
}

@AfterTemplate
@AlsoNegation
boolean after(Instant a, Instant b) {
    return a.isBefore(b);
}
See also https://www.infoq.com/news/2022/10/error-prone-support/
r
Correct that is my idea. Infer those refaster templates from git patches
because those templates/receipes are the adoption bottleneck
j
Adoption-wise: yes, enabling everything will lead to a lot of changes. We first disabled many rules, and then enabled them one-by-one until the point that all of them are enabled atm.
r
This is what I was doing in walkmod. The problem is that, usually, to understand changes you do not want to apply them as a whole because you loose why it was applied, and if there is a bug, you do not know from where