File tree Expand file tree Collapse file tree 2 files changed +13
-14
lines changed
main/java/com/google/gson
test/java/com/google/gson/functional Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ public final class Gson {
134
134
private final boolean generateNonExecutableJson ;
135
135
private final boolean prettyPrinting ;
136
136
private final boolean lenient ;
137
- private JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory ;
137
+ private final JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory ;
138
138
139
139
/**
140
140
* Constructs a Gson object with default configuration. The default configuration has the
@@ -488,14 +488,13 @@ public <T> TypeAdapter<T> getAdapter(TypeToken<T> type) {
488
488
* @since 2.2
489
489
*/
490
490
public <T > TypeAdapter <T > getDelegateAdapter (TypeAdapterFactory skipPast , TypeToken <T > type ) {
491
- boolean skipPastFound = false ;
492
-
493
491
// Hack. If the skipPast factory isn't registered, assume the factory is being requested via
494
492
// our @JsonAdapter annotation.
495
493
if (!factories .contains (skipPast )) {
496
494
skipPast = jsonAdapterFactory ;
497
495
}
498
496
497
+ boolean skipPastFound = false ;
499
498
for (TypeAdapterFactory factory : factories ) {
500
499
if (!skipPastFound ) {
501
500
if (factory == skipPast ) {
Original file line number Diff line number Diff line change @@ -274,20 +274,20 @@ private static final class LongToStringTypeAdapterFactory implements TypeAdapter
274
274
}
275
275
276
276
public void testFieldAnnotationWorksForParameterizedType () {
277
- Gson gson = new Gson ();
278
- String json = gson .toJson (new Gizmo2 (Arrays .asList (new Part ("Part" ))));
279
- assertEquals ("{\" part\" :\" GizmoPartTypeAdapterFactory\" }" , json );
280
- Gizmo2 computer = gson .fromJson ("{'part':'Part'}" , Gizmo2 .class );
281
- assertEquals ("GizmoPartTypeAdapterFactory" , computer .part .get (0 ).name );
282
- }
277
+ Gson gson = new Gson ();
278
+ String json = gson .toJson (new Gizmo2 (Arrays .asList (new Part ("Part" ))));
279
+ assertEquals ("{\" part\" :\" GizmoPartTypeAdapterFactory\" }" , json );
280
+ Gizmo2 computer = gson .fromJson ("{'part':'Part'}" , Gizmo2 .class );
281
+ assertEquals ("GizmoPartTypeAdapterFactory" , computer .part .get (0 ).name );
282
+ }
283
283
284
284
private static final class Gizmo2 {
285
- @ JsonAdapter (Gizmo2PartTypeAdapterFactory .class )
286
- List <Part > part ;
287
- Gizmo2 (List <Part > part ) {
288
- this .part = part ;
289
- }
285
+ @ JsonAdapter (Gizmo2PartTypeAdapterFactory .class )
286
+ List <Part > part ;
287
+ Gizmo2 (List <Part > part ) {
288
+ this .part = part ;
290
289
}
290
+ }
291
291
292
292
private static class Gizmo2PartTypeAdapterFactory implements TypeAdapterFactory {
293
293
@ Override public <T > TypeAdapter <T > create (Gson gson , final TypeToken <T > type ) {
You can’t perform that action at this time.
0 commit comments