> +         Type type = ownerType.getType();
> +         if (ownerType.getRawType() != declaring || !(type instanceof 
> ParameterizedType))
> +            return null;
> +         Type keyType = ((ParameterizedType) 
> type).getActualTypeArguments()[0];
> +         Type valueType = ((ParameterizedType) 
> type).getActualTypeArguments()[1];
> +         TypeAdapter<?> keyAdapter = gson.getAdapter(TypeToken.get(keyType));
> +         TypeAdapter<?> valueAdapter = 
> gson.getAdapter(TypeToken.get(valueType));
> +         return newAdapter(keyAdapter, valueAdapter);
> +      }
> +
> +      @SuppressWarnings("unchecked")
> +      protected <K, V, T> TypeAdapter<T> newAdapter(TypeAdapter<K> 
> keyAdapter, TypeAdapter<V> valueAdapter) {
> +         return (TypeAdapter<T>) new ImmutableMapTypeAdapter<K, 
> V>(keyAdapter, valueAdapter);
> +      }
> +   }
> +
>     private static final class MapTypeAdapter<K, V> extends 
> TypeAdapter<Map<K, V>> {

Waiddaminute...if I'm understanding this correctly, `MapTypeAdapter` _already_ 
[builds an immutable 
map](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/json/internal/NullFilteringTypeAdapterFactories.java#L299-309)?
 If that is correct, what is the difference here?

And if we **do** need a different adapter, is there any way to cut down on the 
duplication between IMTA/MTA and IMTAF/MTAF?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/455/files#r15496975

Reply via email to