mirror of
https://github.com/fankes/moshi.git
synced 2025-10-20 00:19:21 +08:00
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:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user