https://kotlinlang.org logo
Title
x

xenoterracide

12/21/2017, 4:36 AM
I wouldn't advise field hiding
e

edwardwongtl

12/21/2017, 4:37 AM
That's not my concern, I just need a way to do it
I got resolution ambiguity when trying to do this in Kotlin
x

xenoterracide

12/21/2017, 4:53 AM
sorry, no idea, most quality analysis tools correctly complain about it in java, so , good luck (honestly new to kotlin so wouldn't have an idea either way)
also you say it's public and I think that type is mutable, which is a security issue if you're running on a shared jvm
and it's not thread safe
that said I can empathize with "I need to do it"
e

edwardwongtl

12/21/2017, 4:55 AM
Well the parent class is not written by me
x

xenoterracide

12/21/2017, 4:56 AM
I figured
but why can't the subclass have a different name
and not be public
e

edwardwongtl

12/21/2017, 4:57 AM
And I'm trying to convert a child class to Kotlin, but the child class uses this field hiding technique, so I'm trying to find a way to do it
x

xenoterracide

12/21/2017, 4:57 AM
yeah, I don't know, sorry
I'd consider just giving the field a different name
and accessing it with accessors
but, yeah, sorry, not of much help
e

edwardwongtl

12/21/2017, 5:00 AM
Nevermind