Move Kotlin reflection into a kotlin/reflect directory

The maven coordinates stay the same.
This commit is contained in:
Jesse Wilson 2018-05-14 17:13:19 -04:00
parent a0df085b81
commit 60cb608956
6 changed files with 36 additions and 29 deletions

View file

@ -15,9 +15,11 @@
*/
package com.squareup.moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
@Deprecated(
message = "this moved to avoid a package name conflict in the Java Platform Module System.",
replaceWith = ReplaceWith("com.squareup.moshi.kotlin.KotlinJsonAdapterFactory")
replaceWith = ReplaceWith("com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory")
)
class KotlinJsonAdapterFactory
: JsonAdapter.Factory by com.squareup.moshi.kotlin.KotlinJsonAdapterFactory()
: JsonAdapter.Factory by KotlinJsonAdapterFactory()

View file

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.moshi.kotlin
package com.squareup.moshi.kotlin.reflect
import com.squareup.moshi.Json
import com.squareup.moshi.JsonAdapter
@ -228,8 +228,8 @@ class KotlinJsonAdapterFactory : JsonAdapter.Factory {
val adapter = moshi.adapter<Any>(
resolvedPropertyType, Util.jsonAnnotations(allAnnotations.toTypedArray()))
bindingsByName[property.name] =
KotlinJsonAdapter.Binding(name, adapter, property as KProperty1<Any, Any?>, parameter)
bindingsByName[property.name] = KotlinJsonAdapter.Binding(name, adapter,
property as KProperty1<Any, Any?>, parameter)
}
val bindings = ArrayList<KotlinJsonAdapter.Binding<Any, Any?>?>()

View file

@ -18,6 +18,11 @@
<artifactId>moshi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.moshi</groupId>
<artifactId>moshi-kotlin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>

View file

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.moshi.kotlin
package com.squareup.moshi.kotlin.reflect
import com.squareup.moshi.FromJson
import com.squareup.moshi.Json
@ -350,7 +350,7 @@ class KotlinJsonAdapterTest {
} catch (expected: IllegalArgumentException) {
assertThat(expected).hasMessage("No default value for transient constructor parameter #0 " +
"a of fun <init>(kotlin.Int): " +
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest.RequiredTransientConstructorParameter")
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest.RequiredTransientConstructorParameter")
}
}
@ -637,7 +637,7 @@ class KotlinJsonAdapterTest {
fail()
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessage("No JsonAdapter for interface " +
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest\$Interface (with no annotations)")
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$Interface (with no annotations)")
}
}
@ -650,7 +650,7 @@ class KotlinJsonAdapterTest {
fail()
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessage("Cannot serialize abstract class " +
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest\$AbstractClass")
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$AbstractClass")
}
}
@ -663,7 +663,7 @@ class KotlinJsonAdapterTest {
fail()
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessage("Cannot serialize inner class " +
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest\$InnerClass")
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$InnerClass")
}
}
@ -677,7 +677,7 @@ class KotlinJsonAdapterTest {
fail()
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessage("Cannot serialize local class or object expression " +
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest\$localClassesNotSupported\$LocalClass")
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$localClassesNotSupported\$LocalClass")
}
}
@ -688,7 +688,7 @@ class KotlinJsonAdapterTest {
fail()
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessage("Cannot serialize object declaration " +
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest\$ObjectDeclaration")
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$ObjectDeclaration")
}
}
@ -706,7 +706,7 @@ class KotlinJsonAdapterTest {
fail()
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessage("Cannot serialize local class or object expression " +
"com.squareup.moshi.kotlin.KotlinJsonAdapterTest\$objectExpressionsNotSupported" +
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$objectExpressionsNotSupported" +
"\$expression$1")
}
}

View file

@ -21,8 +21,8 @@
<module>moshi</module>
<module>examples</module>
<module>adapters</module>
<module>kotlin</module>
<module>kotlin/codegen</module>
<module>kotlin/reflect</module>
<module>kotlin/tests</module>
</modules>