Wrong error about @GetterName?
See original GitHub issueI’m seeing this trying to build my project:
MembershipData.java:81: error: Kotshi: Could not find a getter named getIs_premium, annotate the parameter with @GetterName if you use @JvmName
com.chess.net.model.ExpirationInfo date, int is_premium, int level, @org.jetbrains.annotations.NotNull()
^
Here is my code:
@JsonSerializable
class MembershipItem(
override val data: MembershipData
) : BaseResponseItem<MembershipData>(data = data)
/* SAMPLE JSON
"date": {
"expires": 1555570800,
"last_renewed": 1524034800,
"start": 1369258234
},
"is_premium": 0,
"level": 0,
"result": "success",
"sku": "gold_monthly",
"type": "basic",
"user_id": 41,
"is_trial_eligible": false
"is_apple_auto_renewable": false
"is_google_subscription": false
*/
@JsonSerializable
data class MembershipData(
val date: ExpirationInfo = ExpirationInfo(),
val is_premium: Int = 0, // it's complaining about this line, seemingly
val level: Int = 0,
val result: String = "",
val sku: String = "",
val type: String = "",
val user_id: Int = 0,
val is_trial_eligible: Boolean = false,
val is_apple_auto_renewable: Boolean = false,
val is_google_subscriber: Boolean = false
)
@JsonSerializable
data class ExpirationInfo(
val expires: Long = 0,
val last_renewed: Long = 0,
val start: Long = 0
)
I will note that a very similar structure works for other data classes, without issue. Any ideas? I’m using v1.0.2
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
NoSuchMethodError: The getter "name" was called on null
the error, the error is in the condition (it's quite subtle): if (_nearbyCarpark = null). is an assignment ( = ) and not...
Read more >Best Practices for Java Getter and Setter - DZone
In this post, we take a closer look at getter and setter methods in Java, common mistakes, and best practices for combating these...
Read more >@Getter and @Setter - Project Lombok
For boolean fields that start with is immediately followed by a title-case letter, nothing is prefixed to generate the getter name. Any variation...
Read more >Java Getter and Setter Tutorial - from Basics to Best Practices
This section describes the most common mistakes when implementing setter and getter in Java, and workarounds. Mistake #1: Have setter and getter ...
Read more >Effective Go - The Go Programming Language
There's nothing wrong with providing getters and setters yourself, ... but it's neither idiomatic nor necessary to put Get into the getter's name....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Released in 1.0.3
I tried that first and it didn’t work… Actually I didn’t have the actual getter at that point. But anyway, yeah, fixed soon. Thanks!