# intellij

Laurent Laborde

01/29/2023, 4:22 PM
when converting java file to kotlin file, intellij is automagically converting java method getSomething(), setSomething(), isSomething() to a var something. While it may be a good idea in theory for trivial code, it can create a lot of problem and there is a cascade of inheritance, abstract class, overriding, a mix of java and kotlin class. i tried my best for a while but now i have tons of “Inherited platform declaration clash” with a mix of var and fun/method and abstract and override ... is there a way to tell intellij to stop changing all the get/set method to a var, and keep them as a get/set fun instead ?
i realize i probably would have been easier if converted the super super class first instead of starting from the bottom. but ... too late for that.
overall i end up with tons of “getSomething” override nothing, and Class is not an abstract class and does not implement ... because of all the getSomething kotlinification
i found this 3 years old question with exactly the same question
i managed it somehow but this is really rage inducing. There is really a need to either “stop removing get/set” or “fix the failed conversion of getter/setter”. in any case, this should be configurable.
when you have multiple getter with different arguments, you have to convert it all back to conventional java get/setter


01/30/2023, 10:45 AM
I think the best way forward would be to extract a reproducer for java code that can not safely be converted to the compact syntax, and file a youtrack issue for that.

Laurent Laborde

01/30/2023, 11:27 AM
99% of my time is spent dealing with getter/setter, truely a pain 😞
and it’s always a compromise between using @JvmField, kotlin style getter/setter, java style getter/setter
i even have a method called GetValue() and SetValue(), which is blindly converted to “value”. i let you imagine all the problems it create 😄