intellij-community
intellij-community copied to clipboard
[Fernflower] new option -osc: solves problems with method/field selection
New option -osc (OVERLOADING_SAFETY_CASTS), turned off by default. Fix for IDEA-135385 and others.
Overloaded and hidden fields and methods caused errors. All parameters types and the caller type must match the descriptor exactly, if not a cast is needed. The reason is that the current instance could have been cast to a sub/super class in the original code and we cannot know that. And we don't know if the method/field is overloaded on that sub/super class.
This options adds a lot more casts to the decompiler output, but it is much safer and can solve many cases that fail otherwise. Test cases included in this pull request: https://github.com/JetBrains/intellij-community/pull/390