Issue #28585 has unlocked our ability to simplify and hide a details with AOT APIs. If we migrate our tests to use GeneratedClasses we can then make the following changes:

  • Drop the MethodGenerator interface
  • Make GeneratedMethods and GeneratedClasses have package-private constructors
  • Make some currently public methods package-private since they're only called from the aot package
  • Change the using or builder methods so that Consumer fields can be final.

In addition we can also fix the variable and parameter names from builder to type or method so that it becomes more obvious what is being built.