rharter/auto-value-moshi

Support for package-private jsonAdapter method

nedtwigg opened this issue · 7 comments

auto-value-moshi requires a method like this:

public static JsonAdapter<MyAutoValueClass> jsonAdapter(Moshi moshi) { ... }

Are you open to a PR which would allow this?

static JsonAdapter<MyAutoValueClass> jsonAdapter(Moshi moshi) { ... }

With Java 9 modularity coming, I'd like the option to use Moshi as an implementation detail which is invisible to client code.

Eyeballed nedtwigg@cd905ac

I think that mostly works, but we should do extra checks at compile-time to basically make sure we're only including models from the same package if we do this, otherwise you could get confusing error messages about not generating anything if you have multiple factories in different packages

Looks like there's been quite a bit of really useful stuff since 0.4.5: 0.4.5...master

In addition to this issue, upgrading to AutoValue 1.6 and implementing net.ltgt.gradle.incap.IncrementalAnnotationProcessorType.AGGREGATING would be big wins. I know there's always more I try to stuff into my releases, but it would be really cool to get an 0.4.6 as-is out on MavenCentral. It's 0.x stuff, no warranty expected :)

WAAAHOOOO!!! Thanks so much for 0.4.6! This is such a useful library, great to see it shipping again :)