https://kotlinlang.org logo
#feed
Title
y

Youssef Shoaib [MOD]

08/17/2021, 4:55 AM
After an interesting discussion about a nice Java interop feature where you can allow Java callers to pass in
null
in place of default parameters to have the default values substituted in automatically, I went on and implemented that in a compiler plugin. This might be useful for someone (I guess), even as a starting stone into learning compiler plugins. Any feedback or criticism is very recommended 😄
t

Tomasz Krakowiak

08/17/2021, 9:07 AM
What if parameter is of nullable type, but default value is different from null?
y

Youssef Shoaib [MOD]

08/17/2021, 10:00 AM
Currently, it just replaces null with the default value even if the type is nullable. However, that behaviour probably isn't the most correct I would say. It's just kind of difficult to determine what the correct and least surprising behaviour should be here
3 Views