Fix companion object names not being resolved (#549)

* Fix companion object names not being resolved

This slipped through the cracks before the release

Fixes #546

* Add braces on the else clause for symmetry
This commit is contained in:
Zac Sweers
2018-05-16 12:44:07 -07:00
committed by Jesse Wilson
parent d48e3aaa27
commit b956b06f6d
3 changed files with 29 additions and 8 deletions

View File

@@ -786,6 +786,22 @@ class GeneratedAdaptersTest {
@JsonClass(generateAdapter = true)
class DuplicateValue(var a: Int = -1, var b: Int = -2)
@Test fun companionObjectsTests() {
val moshi = Moshi.Builder().build()
val standardAdapter = CompanionObjectClass.jsonAdapter(moshi)
val customNameAdapter = NamedCompanionObjectClass.jsonAdapter(moshi)
}
@JsonClass(generateAdapter = true)
data class CompanionObjectClass(val foo: String) {
companion object
}
@JsonClass(generateAdapter = true)
data class NamedCompanionObjectClass(val foo: String) {
companion object CustomCompanionObject
}
@JsonQualifier
annotation class Uppercase(val inFrench: Boolean, val onSundays: Boolean = false)