New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
annotations and [package|regular] objects #3115
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3115?orig=1 |
@vjovanov said: I would like to deprecate the whole package and I can not do it in any way except by going to all public classes and objects and annotating them with @deprecated. In my case the package has quite a few classes and annotating them is not negligible work. |
@paulp said: What we need is this: New meta-annotations in scala.annotation.meta for object and class (of course they can't be called that because the identifiers are reserved) so one can attach an annotation to a package object and designate whether it applies to the package object itself, the whole package, or both. Then the deprecation code has to notice it, which means considering the annotations of all enclosing package objects of any given member when issuing warnings. |
@janekdb said: Context: scala/scala-parser-combinators#99 Code, package scala.util.parsing
/**
* This package was never intended for production use; it's really more of a code sample demonstrating how to use parser combinators.
*
* Use [[https://index.scala-lang.org/ The Scala Library Index]] to find alternative JSON parsing libraries.
*/
@deprecated("Use The Scala Library Index to find alternatives: https://index.scala-lang.org/", "1.0.6")
package object json {} Error, [error] scala-parser-combinators/shared/src/main/scala/scala/util/parsing/json/package.scala:9: expected start of definition
[error] package object json {}
[error] ^ |
#12496 notes that |
This seems like a good project for an interested contributor. Is it fixed in Scala 3? |
This is the working syntax, but it does not suppress the deprecations in Same result in Scalae 2 & 3. |
I was hoping to deprecate a package object ("what? already?") since the whole package has moved and that would be the cleanest way to deprecate the forwarding stubs, but:
As I began this ticket I thought that deprecating an object tagged everything inside it as deprecated, but that doesn't seem to be the case. It is what I had intended for scala.Math, but now I find that referencing it directly gets the warning, but its contents skate by:
Hopefully there is some remedy possible short of directly annotating all several dozen of scala.Math's members. Actually even that isn't much of a remedy because that code is all shared with the undeprecated scala.math package.
(I know nobody would DREAM of suggesting cutting and pasting, so let's not even go there.)
The text was updated successfully, but these errors were encountered: