1. I notice that when I declare a `private compan...
# compiler
1. I notice that when I declare a
private companion object
, the
class is compiled as package-private in the bytecode, but the static
field is compiled as public + deprecated in the bytecode. Why is this? 2. Because of this, in the IDE, from a Java call-site, I can can compile and run
Object object = DeferredBoolean.Attribute.Companion;
without issue. The
field doesn’t even get a strikethrough, which seems like an IDE bug. Assuming this hasn’t already been fixed in a new IDE version, and depending on the answer to #1, should I file an IDE bug?
1. The field was public in this case since Kotlin 1.0 because of a bug (should've been private). We fixed it gracefully by making the field public deprecated in 1.3, and then it'll be private in 1.4. See https://youtrack.jetbrains.com/issue/KT-11567 2. Yes, it should have a strikethrough in the IDE as long as you have the Kotlin language version configured to 1.3+ in build or IDE settings. If it doesn't, please report an issue
Ooh, so updating a library to 1.4 may be a binary breaking change, good to know! ok, i’ll check some different IDE versions and report the issue