1

According to this answer package-level deprecation is possible in Java via package-info.java like so:

/**
 * @deprecated As of release 2.0, replaced by {@link com.acme.new.package}
 */
@Deprecated
package com.acme.old.package;

Is there something similar to this mechanism in Kotlin? The Deprecated page documentation doesn't seem to offer guidance on this and I'd prefer not to annotate every function, field, and class separately.

Mike Holler
  • 945
  • 2
  • 13
  • 28

1 Answers1

2

You can use the same package-info.java; Kotlin should recognize the deprecations specified in it, and if it doesn't, it's a bug. Kotlin has no syntax of its own for specifying package-level annotations.

yole
  • 92,896
  • 20
  • 260
  • 197
  • Thanks that makes sense, although I wish there was a way to do this that allowed me to put KDoc alongside the deprecation. – Mike Holler Apr 09 '18 at 15:11