is there any way to mark the class generated by `@...
# announcements
j
is there any way to mark the class generated by
@file:JvmName("...")
as
@Deprecated
?
closest I could get is:
Copy code
@file:JvmName("Foo")

@Deprecated("Foo")
object Foo
but this doesn’t work seamlessly with other top-level elements in the file
s
Doesnt this work ?
Copy code
@file:Deprecated()

package org.foo
t
Unfortunately, the
Deprecated
annotation cannot target a file. To me, it makes more sense to deprecate individual declarations from that file rather than the whole utility class visible from Java, as deprecations will not be visible from Kotlin.
👍 1
s
It did compile when using the java Deprecated annotation
j
Interesting, I see
@JvmName
has
AnnotationTarget.FILE
but
@Deprecated
doesn’t
At least not in K 1.3.60
Good point about deprecations not appearing in Kotlin source. In some cases that might be intentional, but at least in the situation I’m dealing with, deprecating the relevant elements gets the job done.