-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix #9324: forbid no-arg java.lang.Enum ctor #10027
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
Why is this not forbidden by default? |
44d022c
to
04da9e2
Compare
good point- will adjust |
so now there is just an extra error in the case where it was possible to call the no arg ctor, which basically only ever could happen in migration mode |
this still doesn't deal with this: // running repl with -source:3.0-migration
scala> final class C extends jl.Enum[C]("N")
1 |final class C extends jl.Enum[C]("N")
| ^^^^^^^^^^
|None of the overloaded alternatives of constructor Enum in class Enum with types
| [E <: Enum[LazyRef(E)]](x$0: String, x$1: Int): Enum[E]
| [E <: Enum[LazyRef(E)]](): Enum[E]
|match arguments (("N" : String)) do we want the other thing to never exist in overload errors?, and files can locally import a language mode for source so we can't patch it in |
If it's only temporary for migration the overload error message is fine |
pretend the no-arg constructor does not exist unless called from an enum parent