Repository: square/moshi
Issue: Android: failing to find adapter for a 'GenericArrayTypeImpl' type

We have an adapter in place to process `byte[]` as a base64 / base32 string. Everything works fine when a class has a `byte[]` field, but parsing json fails on Android when we have a field of type `Map<String, byte[]>`. The code below works in the standard JVM but fails on Android.

``` java
  class Base32Adapter extends JsonAdapter<byte[]>  {
    @Override
    public byte[] fromJson(JsonReader reader) throws IOException {
      String string = reader.nextString();
      return new BigInteger(string, 32).toByteArray();
    }

    @Override
    public void toJson(JsonWriter writer, byte[] bytes) throws IOException {
      String string = new BigInteger(bytes).toString(32);
      writer.value(string);
    }
  }

  static class FavoriteBytes {
    @Json(name = "Bytes")
    public Map<String, byte[]> keys;
  }

  @Test public void customAdapter() throws Exception {
    String jsonString = "{\\"Bytes\\":{\\"jesse\\":\\"a\\",\\"jake\\":\\"1\\"}}";
    Moshi binaryMoshi = new Moshi.Builder().add(byte[].class, new Base32Adapter()).build();
    FavoriteBytes fav = binaryMoshi.adapter(FavoriteBytes.class).fromJson(jsonString);

    assertThat(fav.keys).containsOnlyKeys("jesse", "jake");
    assertThat(fav.keys.get("jesse")).isEqualTo(new byte[] { 0xa });
    assertThat(fav.keys.get("jake")).isEqualTo(new byte[] { 0x1 });
  }
```

On Android, this fails with exception:

```
E/MoshiTest(18268): com.squareup.moshi.JsonDataException: Expected BEGIN_ARRAY but was STRING at path $.Keys.jesse
E/MoshiTest(18268):     at com.squareup.moshi.JsonReader.beginArray(JsonReader.java:346)
E/MoshiTest(18268):     at com.squareup.moshi.ArrayJsonAdapter.fromJson(ArrayJsonAdapter.java:53)
E/MoshiTest(18268):     at com.squareup.moshi.JsonAdapter$1.fromJson(JsonAdapter.java:68)
E/MoshiTest(18268):     at com.squareup.moshi.MapJsonAdapter.fromJson(MapJsonAdapter.java:68)
E/MoshiTest(18268):     at com.squareup.moshi.MapJsonAdapter.fromJson(MapJsonAdapter.java:29)
E/MoshiTest(18268):     at com.squareup.moshi.JsonAdapter$1.fromJson(JsonAdapter.java:68)
E/MoshiTest(18268):     at com.squareup.moshi.ClassJsonAdapter$FieldBinding.read(ClassJsonAdapter.java:183)
E/MoshiTest(18268):     at com.squareup.moshi.ClassJsonAdapter.fromJson(ClassJsonAdapter.java:144)
E/MoshiTest(18268):     at com.squareup.moshi.JsonAdapter$1.fromJson(JsonAdapter.java:68)
E/MoshiTest(18268):     at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:33)
E/MoshiTest(18268):     at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:37)
...
```


Changed files:
moshi/src/main/java/com/squareup/moshi/internal/Util.java

diff --git a/moshi/src/main/java/com/squareup/moshi/internal/Util.java b/moshi/src/main/java/com/squareup/moshi/internal/Util.java
index 0744728..e16980a 100644
--- a/moshi/src/main/java/com/squareup/moshi/internal/Util.java
+++ b/moshi/src/main/java/com/squareup/moshi/internal/Util.java
@@ -45,7 +45,7 @@ public final class Util {
 
   public static boolean typesMatch(Type pattern, Type candidate) {
     // TODO: permit raw types (like Set.class) to match non-raw candidates (like Set<Long>).
-    return pattern.equals(candidate);
+    return Types.equals(pattern, candidate);
   }
 
   public static Set<? extends Annotation> jsonAnnotations(AnnotatedElement annotatedElement) {