Closed bryanstern closed 5 years ago
Fixes #226.
Invalid java code was being generated when trying to instantiate a builder with generics via its factory method inside the TypeAdapter#read.
TypeAdapter#read
The fix is to use the builder's type rather than class when declaring the builder field inside of TypeAdapter#read.
I've also updated GenericsExample to show that it works and to serve as a test. The read method generated now looks like.
GenericsExample
public GenericsExample<A, B, C> read(JsonReader jsonReader) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { jsonReader.nextNull(); return null; } jsonReader.beginObject(); GenericsExample.Builder<A, B, C> builder = GenericsExample.builder(); ... }
Fixes #226.
Invalid java code was being generated when trying to instantiate a builder with generics via its factory method inside the
TypeAdapter#read
.The fix is to use the builder's type rather than class when declaring the builder field inside of
TypeAdapter#read
.I've also updated
GenericsExample
to show that it works and to serve as a test. The read method generated now looks like.