Skip to content
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

deprecation and [package|regular] objects #3115

Open
scabug opened this issue Feb 27, 2010 · 7 comments
Open

deprecation and [package|regular] objects #3115

scabug opened this issue Feb 27, 2010 · 7 comments
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Feb 27, 2010

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:

[scalacfork] /scala/trunk/src/library/scala/util/parsing/syntax/package.scala:14: error: expected start of definition
[scalacfork] package object syntax {
[scalacfork] ^
[scalacfork] one error found

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:

scala> scala.Math   
<console>:5: warning: object Math in package scala is deprecated: use scala.math package instead

scala> scala.Math.Pi
res0: Double = 3.141592653589793

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.)

@scabug
Copy link
Author

@scabug scabug commented Feb 27, 2010

@scabug
Copy link
Author

@scabug scabug commented Mar 8, 2010

@odersky said:
(In r21100) Closes #3115. Reviw by rytz

@scabug
Copy link
Author

@scabug scabug commented Mar 21, 2012

@vjovanov said:
I am reopening this issue as package objects still can not be deprecated and from the the comments and commits I can not see the clear resolution for that matter.

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.

@scabug
Copy link
Author

@scabug scabug commented Mar 21, 2012

@paulp said:
Yeah, it looks like I did them all manually in scala.Math.

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.

@scabug
Copy link
Author

@scabug scabug commented Mar 15, 2013

@adriaanm said:
Un-assigning to foster work stealing, as announced in https://groups.google.com/forum/?fromgroups=#!topic/scala-internals/o8WG4plpNkw

@scabug
Copy link
Author

@scabug scabug commented Jul 10, 2013

@adriaanm said:
Unassigning and rescheduling to M6 as previous deadline was missed.

@scabug
Copy link
Author

@scabug scabug commented Feb 14, 2017

@janekdb said:
Confirming that package level deprecation remains unimplemented.

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] ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant