diff --git a/gson/src/test/java/com/google/gson/functional/JsonAdapterAnnotationOnClassesTest.java b/gson/src/test/java/com/google/gson/functional/JsonAdapterAnnotationOnClassesTest.java index a697ff8e..b753f289 100644 --- a/gson/src/test/java/com/google/gson/functional/JsonAdapterAnnotationOnClassesTest.java +++ b/gson/src/test/java/com/google/gson/functional/JsonAdapterAnnotationOnClassesTest.java @@ -158,6 +158,11 @@ public final class JsonAdapterAnnotationOnClassesTest extends TestCase { } static final class JsonAdapterFactory implements TypeAdapterFactory { public TypeAdapter create(Gson gson, final TypeToken type) { + + // Ensure that gson.getDelegateAdapter continues to work for type adapter factories + // registered through JsonAdapter annotation. Query for a random type adapter. + gson.getDelegateAdapter(this, TypeToken.get(JsonAdapterAnnotationOnFieldsTest.class)); + return new TypeAdapter() { @Override public void write(JsonWriter out, T value) throws IOException { out.value("jsonAdapterFactory");