title: Kotlin Moshi Adapter not called
body: <p>I'm trying to write a Moshi adapter in Kotlin that will create enums based on an integer value, and will also default to a specific enum value if it encounters an unsupported value.</p>
  
  <p>My adapter is never getting called, which causes the default enum adapter to fail with the included stacktrace.</p>
  
  <p>Tracing the code show that the <code>@ToJson</code> annotation somehow isn't present, and so the adapter <a href="https://github.com/square/moshi/blob/master/moshi/src/main/java/com/squareup/moshi/AdapterMethodsFactory.java#L111" rel="nofollow noreferrer">isn't added when it should be</a>.</p>
  
  <p>Declaring the adapter</p>
  
  <pre><code>enum class Status {
      IDLE,
      IN_PROGRESS,
      FAILED,
      SUCCESS,
      UNKNOWN;
  
      companion object {
          private val map = Status.values().associateBy(Status::ordinal);
          fun fromInt(type: Int?): Status {
              var ret = map[type]
              if (ret == null) {
                  ret = UNKNOWN
              }
              return ret
          }
  
      }
  
      class Adapter {
          @ToJson
          fun toJson(status: Status): Int {
              return status.ordinal
          }
  
          @FromJson
          fun fromJson(value: Int): Status {
              return fromInt(value)
          }
      }
  }
  </code></pre>
  
  <p>Building Moshi</p>
  
  <pre><code>@Provides
  @Singleton
  fun provideMoshi(): Moshi {
      return Moshi.Builder()
              .add(Status.Adapter())
              .add(KotlinJsonAdapterFactory())
              .build()
  }
  </code></pre>
  
  <p>Dependencies</p>
  
  <pre><code>implementation 'com.squareup.moshi:moshi:1.6.0'
  implementation 'com.squareup.moshi:moshi-kotlin:1.6.0'
  </code></pre>
  
  <p>Stacktrace</p>
  
  <pre><code>05-29 18:57:56.603 24560-24560/com.example.app E/MyActivity: com.squareup.moshi.JsonDataException: Expected one of [IDLE, IN_PROGRESS, FAILED, SUCCESS, UNKNOWN] but was 2 at path $[0].status
      at com.squareup.moshi.StandardJsonAdapters$EnumJsonAdapter.fromJson(StandardJsonAdapters.java:297)
      at com.squareup.moshi.StandardJsonAdapters$EnumJsonAdapter.fromJson(StandardJsonAdapters.java:266)
      at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
      at com.squareup.moshi.ClassJsonAdapter$FieldBinding.read(ClassJsonAdapter.java:196)
      at com.squareup.moshi.ClassJsonAdapter.fromJson(ClassJsonAdapter.java:158)
      at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
      at com.squareup.moshi.CollectionJsonAdapter.fromJson(CollectionJsonAdapter.java:76)
      at com.squareup.moshi.CollectionJsonAdapter$2.fromJson(CollectionJsonAdapter.java:53)
      at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
      at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:45)
      at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:27)
      ...
  </code></pre>