https://kotlinlang.org logo
#getting-started
Title
# getting-started
r

Richard Gomez

08/27/2021, 3:54 PM
Perhaps I'm misremembering, but isn't it possible to override a getter with a val? Given the following Java interface, I'd thought I'd be able to satisfy it with `data class MyOAuth2User(override val name: String) : OAuth2User`; however, it complains that
'name' overrides nothing
.
Copy code
// OAuth2User.java
public interface OAuth2User {
    String getName();
}
1
h

hho

08/27/2021, 4:34 PM
r

Richard Gomez

08/27/2021, 4:46 PM
Done! Hopefully it gets picked up as the workaround is quite awkward.
(Also, in retrospect, I was probably thinking of Groovy.)
2 Views