-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[SUPERSEDED] Escalate or de-escalate deprecations #7728
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
Conversation
|
First win: Speaking string prefixes, maybe taking just a prefix of the name is good enough, rather than requiring a package. |
Does that also work if the library name contains a dot? Random example: |
|
Hypothetical syntax I found "in" and "from" terminology confusing. There's the deprecated thing, which might be a program element but might be a feature like early definitions; and there is the location, nominally the error position, which could be expressed as a source position or a program element. The other feature to inflict is a filtering reporter that uses output from a previous run, similar to a partest check file, as a whitelist of messages. For a huge list of warnings, it's easy to update and then ignore the huge list; you'd only see new warnings. Conversely, it's easy to edit the list for warnings you actually want to fix. That would also be an opportunity to match messages like "early initializers are dep" at any position to either ignore them or escalate them. |
|
Perhaps we should give people the option to apply a regexp filter to the warning messages. |
|
I think that we need something sophisticated here, as discussed with @retronym so suit our specific environment In general we need to ability to deprecate some things that are not yet deprecated, and mark some things that are deprecated as not. This sounds a it weird, but here is the logic When we decide to migrate to say 2.13, we will need to move code to a common subset, something that we can compile in 2.12 and 2.13, for an extended period of time. Generally we have zero deprecation policy. When migrating the code we will need to change to not use for example scala.collection.breakOut, so we can migrate the code to a different pattern - e.g. .toIterator.map(…).toSet, and we need to ensure that usages of breakOut don't creep back, so we could deprecate breakout for our 2.12 compiles Similarly we make look at an API that is deprecated in 2.13, but decide to cope with that rewrite after we have migrated to 2.13. Clearly we don't want to compile 2.13 without deprecation, as we need a finer control Also in some applications we want to restrict usage of some APIs, e.g. scala.collection.parallel._ or use of views when these cause issues with other infra in the application or some local code standard All of these need finer control to switch on or off deprecation at a fine grained level |
|
@mkeskells suppressing a deprecation is already supported; I'll try to add ad-hoc deprecation. The general use case of: Apply 2.13 deprecations to my 2.12 build, I'll consider out of scope here. I'll clean up the "policy" syntax and add syntax for "label". |
2147d76 to
640b155
Compare
In order to facilitate turning a deprecation into a compile-time error, introduce a deprecatedError annotation that is intended to result in a user-friendly error message instead of "no such method" or similar, which would result from simply removing the API.
|
Parking this reference here, since opinions are floated about deprecation policies. From guava:
|
|
@som-snytt what is this mechanism? The need that we have is ad-hoc, not related to particular versions. I know that other organisations have also had this need and crafted their own solutions |
|
I needed this today. While trying This may be a blocker for enabling |
Taking up Adriaan's idea. Still rough and
frommode isn't wired up. I was too lazy to fetch the original commit. Turning off edits at least until it's further along. More bright ideas welcome.Slightly different syntax:
Also
--com.acmefor silent. I don't like'com.acmeforfrommode, and resisting@.