Add @uncheckedOverride annotation for definitions that may override#11175
Add @uncheckedOverride annotation for definitions that may override#11175lrytz merged 2 commits intoscala:2.12.xfrom
@uncheckedOverride annotation for definitions that may override#11175Conversation
sjrd
left a comment
There was a problem hiding this comment.
I really like the @uncheckedOverride. 👍
Cool. I'll bring it up at the meeting on Wed, if we do it then we should also do it on Scala 3. |
| * Marking a definition `@uncheckedOverride` is equivalent to the `override` keyword, except that overriding is not | ||
| * enforced. A definition marked `@uncheckedOverride` is allowed to override nothing. | ||
| */ | ||
| final class uncheckedOverride extends StaticAnnotation |
There was a problem hiding this comment.
Can't we make it private[scala]?
There was a problem hiding this comment.
We probably can, but it's a useful feature to have even in user space. The standard library does not have the monopole on having to deal with similar situations.
|
Maybe a separate issue, but the It would be nice to put the new class in Maybe someday we'll get the feature that And maybe The current idiom is |
|
I'll leave it there in company with the other uncheckedX annotations.
The board agrees. |
|
@lrytz is the compilation failure in Spire at https://scala-ci.typesafe.com/job/scala-2.12.x-jdk21-integrate-community-build/1214/artifact/logs/spire-build.log expected? |
|
Ah, the 2.12.x build... Hm. This PR changes the signature from If we want to be able to compile the 2.12 standard library on Java 26, I don't see another way. Even if we don't, I'm not sure it would work to keep the old signature in the 2.12 standard library and allow users to compile their Ordering subclasses on Java 26. So changing the signatures looks like the cleanest solution. Do you think the source compat breakage is acceptable? |
Can't we just say 2.12.x will not work on Java 26? If people want to move to a newer version of Java, they can move to 2.13.x or 3.x. I know it's not an easy migration but we should upper-bound the JVM version at some point. |
|
They can't move their sbt build away from 2.12.x, though. |
sbt 2.x will be released soon, right? So that will take care of it. |
I suggest we should not care about that for 2.12. In short, I agree with Hamza.
In some other contexts that might be a good point, but in this particular context.... meh, I don't think people actually need to define custom What should 2.12's level of support for JDK 26+ be?For 2.12.x, I think it's worth supporting JDK 25 whenever the effort involved is reasonable. But JDK 26? I suggest we consider JDK 26+ out of scope for 2.12, unless perhaps we receive specific complaints or requests. I don't think we should be proactive about building or testing 2.12 on 26+. (Recall that we aren't even running the Scala 2.12 community build on 25, let alone 26; we stopped at 21.) If we do get specific bug reports relating to 2.12 on 26+, we can triage them then. For any individual issue that is reported, our options will be:
|
I would rather just not support 26+ than break source compat here. I'm fine with adding (Sorry, yes, I know I'm late to the party, only expressing this opinion now, after the PR has been merged...) |
+1. This could be perceived as the first step to EOL |
and if we do make that decision, we could communicate it to the public in two places: |
|
IMO, as long as we support 2.12 we need to make sure 2.12 compiled code runs on the latest released Java version. We cannot announce a 2.12 EOL while sbt 1 ist still in wide use (https://www.scala-lang.org/development/#scala-212-maintenance), and once we announce it, support will still continue for another year. So it doesn't seem unlikely we will end up supporting Java 29 (September 27). We can make a distinction between running 2.12 compiled code and compiling 2.12 code, but we should only do that if there's a strong reason. It could lead to surprises for users, and it could also make testing more complicated for us and for the community. In this particular case, I think we should consider what will cause more pain overall: changing the signature of min/max, or dropping support for compiling on Java >25. I don't expect there to be a lot of |
|
fwiw, I noticed that Spire dropped Scala 2.12 all the way back in 2021 :-) |
|
About the signature changes, there is a middle path: we could revert the signature change for now, for 2.12.21 which is imminent, but consider adding it again by the time JDK 26 final is released. At present, we can't be confident that Oracle won't back out the change; 26 is still early in the early-access phase. There won't be a 26 release candidate until February 2026, with the final release expected in March, as per https://openjdk.org/projects/jdk/26/ |
|
Agree. To show that the issue is real: the following trait cannot be compiled with Scala 2.12 on Java 26: trait O[T] extends scala.math.Ordering[T] {
override def max(x: T, y: T): T = x
} |
### What changes were proposed in this pull request? This PR aims to upgrade `Scala` to `2.13.18`. ### Why are the changes needed? To bring the latest bug fixed version. - https://github.com/scala/scala/releases/tag/v2.13.18 - Fixes for false positive warnings - scala/scala#11165 for Scala 3 - scala/scala#11175 - scala/scala#11172 ### Does this PR introduce _any_ user-facing change? Yes, this is a user-facing Scala version change. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #53396 from dongjoon-hyun/SPARK-54645. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
…#24545) Forward-port of [Scala 2 PR #11175](scala/scala#11175).
…scala#24545) Forward-port of [Scala 2 PR scala#11175](scala/scala#11175).
JDK 26 final is out and still has the signature change, as seen at #11234 so @lrytz, I reviewed the discussion here and I don't really have any new thoughts. personally I'd still be fine with just ignoring JDK 26 on 2.12.x, but I can certainly see why you might decide differently. about sbt 1 on JDK 26, I'll just say that it doesn't bother me unless actual users are actually complaining... and as you already said, I don't think anyone actually needs to override |
Fixes scala/bug#13127
Partially reverted in #11186