https://kotlinlang.org logo
#random
Title
# random
s

samp

06/21/2022, 9:13 PM
In android studio or intelliJ, is there any way to refactor the Java code to replace attribute access to getters and setters? Context: I have a lib which has a class in kotlin and exposes the properties to java consumers with @jvmField but i am removing them and want to use properties gettter method in java codebase. Something like this:
Copy code
String c = class.property;
to
Copy code
String c =  class.getProperty;
I have 1000+ or more usages like this from this internal lib, what's the best way to migrate from property to method?
c

christophsturm

06/22/2022, 9:11 PM
idea has an encapsulate fields refactoring for java code https://www.jetbrains.com/help/idea/encapsulate-fields.html
s

samp

06/22/2022, 10:15 PM
I don't think so my use-case here is: Encapsulate fields, my goal is to use the kotlin generated getters instead of properties access
16 Views