Why `@JvmSynthetic` is not applicable for classes?
# getting-started
m
Why
@JvmSynthetic
is not applicable for classes?
n
synthetic
means the field/method is only accessible through reflection what would that mean for a class? only available through
ClassLoader
stuff? seems weird
👎 1
k
That's definitely not true,
synthetic
means not visible from source. You can't use it when you're writing code, but the compiler can and often does emit bytecode that makes use of synthetic things.
And as per the JVM class format specification classes can be synthetic: https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.1-200-E.1
m
k
Out of curiosity, why do you need this?
m
To hide internal declarations from Java, since we don't have package-private.