https://platformengineering.org logo
Title
j

Jelmer Borst

10/06/2022, 6:44 AM
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

Ivo

10/07/2022, 7:58 PM
Nice read, thanks for sharing!
j

Jelmer Borst

10/14/2022, 11:19 AM
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

Raquel Pau Fernandez

10/14/2022, 5:17 PM
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

Jelmer Borst

10/15/2022, 12:27 AM
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

Raquel Pau Fernandez

10/17/2022, 8:19 AM
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

Jelmer Borst

10/18/2022, 7:43 AM
@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:
@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

Raquel Pau Fernandez

10/18/2022, 7:50 AM
Correct that is my idea. Infer those refaster templates from git patches
because those templates/receipes are the adoption bottleneck
j

Jelmer Borst

10/18/2022, 7:53 AM
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

Raquel Pau Fernandez

10/18/2022, 7:59 AM
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