How records would fit into Google's codebase

Alan Malloy amalloy at
Wed Apr 3 20:03:51 UTC 2019

I have already been using a compiler plugin to do this analysis. The
specific analysis tooling is Google-internal, but it uses APIs similar to
those in Error Prone matchers
consume javac Tree nodes. The work that would need to be done is more in
deciding what patterns to look for, than in the actual mechanics of how to
look for them.

On Wed, Apr 3, 2019 at 12:54 PM Vicente Romero <vicente.romero at>

> Hi Alan,
> Thanks for sharing this doc,
> On 4/3/19 2:53 PM, Brian Goetz wrote:
> > Thanks Alan for this good work; grounding the analysis in real codebases
> is a valuable tool for validating our theories.
> >
> > Some comments inline.
> >
> >> One additional thing I would have liked to do is to somehow find
> classes which were “almost” records, but which ended up not using
> @AutoValue. A survey of these might help us decide what changes we could
> make to increase adoption, or simply confirm for us, “Yes, it’s a good
> thing we included restriction X, because this class is a bad candidate for
> a record, but without restriction X it might have become a record”. Alas,
> unsurprisingly, it is much easier to find actual @AutoValue classes than to
> design a heuristic for “almost an @AutoValue”, and so I have not done this.
> > This is desirable, but as you point out, hard to do — you can’t grep for
> “@WishIWasAnAutoValue”.  Often the best we can do is recall specific
> instances of coding in the past when we tumbled off the cliff, and try to
> reconstruct what was going on.
> on this respect you can probably find useful class:
>, we have used to find things like what
> initializations could be diamonds or lambdas, etc. Most recently it was
> used to find out what explicit variable declarations could be
> substituted by `var`. This analyzer is very powerful. I can help
> providing an analyzer that you can test on your code base. Could you
> please share some of the patters of those could-have-been-autovalue
> classes?
> >
> >> * Records can expect to be about as common as enums
> >
> Thanks,
> Vicente
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the amber-spec-experts mailing list