question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong error about @GetterName?

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ansmancommented, Apr 17, 2018

Released in 1.0.3

0reactions
autonomousappscommented, Mar 21, 2018

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found