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
Deduplicate JavaDeprecatedAttr in ClassfileParser #10422
Conversation
👀
|
This implements the old hrhino suggestion to maintain annotation order in Still need to check whether there was a general assumption that annotations from source were built in reverse. |
0ebbcae
to
b2eda2d
Compare
My first edit retained last added annotation, which I changed when I fixed the failing test. It makes sense to prefer the |
Reminder to self to check how deprecation is emitted. |
b2eda2d
to
5c32b00
Compare
This now implements the lrytz suggestion to confine the special handling to class file parser. |
abadc56
to
334a256
Compare
Of course the |
src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
Outdated
Show resolved
Hide resolved
Thanks, I was so consumed with the previous edit that I did not drill down to answer your question. |
Are we sure that the Also, for the attribute we also add an annotation to the synthetic companion module symbol, but we don't do so for the annotation. This means the "since" message doesn't show when accessing a static member: scala> new A
^
warning: class A is deprecated (since you like it)
val res0: A = A@2c26ba07
scala> A.foo
^
warning: class A is deprecated |
I intended not to assume I'll tackle Nr 2 after coffee. |
I noticed on a recent dotty ticket about Edit:
|
Last commit addresses both review comments: There is no reason to assume attribute ordering, so don't add plain deprecated if it already has it. There is no test. When adding the annotation, also check the static module, verified by test. Did not squash! (My tweaking should be squashed.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise. I think this can be a single commit.
In particular, do not retain two copies. Preserve annotation order although not meaningful. Co-authored-by: Lukas Rytz <lukas.rytz@gmail.com>
54ebd41
to
287d33c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you !
### What changes were proposed in this pull request? This pr aims to upgrade Scala from 2.13.11 to 2.13.12. Additionally, this pr adds ``-Wconf:msg=legacy-binding:s`` to suppress similar compiler warnings as below: ``` [ERROR] /Users/yangjie01/SourceCode/git/spark-mine-13/core/src/main/scala/org/apache/spark/deploy/client/StandaloneAppClient.scala:171: reference to stop is ambiguous; it is both defined in the enclosing class StandaloneAppClient and inherited in the enclosing class ClientEndpoint as method stop (defined in trait RpcEndpoint, inherited through parent trait ThreadSafeRpcEndpoint) In Scala 2, symbols inherited from a superclass shadow symbols defined in an outer scope. Such references are ambiguous in Scala 3. To continue using the inherited symbol, write `this.stop`. Or use `-Wconf:msg=legacy-binding:s` to silence this warning. [quickfixable] Applicable -Wconf / nowarn filters for this fatal warning: msg=<part of the message>, cat=other, site=org.apache.spark.deploy.client.StandaloneAppClient.ClientEndpoint.receive ``` ### Why are the changes needed? The new version bring some regression fixes: - scala/scala#10422 - scala/scala#10424 And a new feature: Quickfixes ``` For some errors and warnings, the compiler now suggests an edit that could fix the issue. Tooling such as IDEs can then offer the edits, or the compiler itself will make the change if run again with -quickfix. ``` - scala/scala#10406 - scala/scala#10482 - scala/scala#10484 The release notes as follows: - https://github.com/scala/scala/releases/tag/v2.13.12 ### Does this PR introduce _any_ user-facing change? Yes, Scala version changed. ### How was this patch tested? Pass Github ### Was this patch authored or co-authored using generative AI tooling? NO Closes #43185 from LuciferYang/SPARK-45331. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
Fixes scala/bug#12799