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
not found: value getClass #12025
Comments
This is intentional: scala/scala#8541 |
@joroKr21 is there a workaround for my case? because attempting
|
|
Ok, so you are saying the 2.12.7 code was incorrect all way long. But why is it illegal to do |
@Jasper-M actually howdy is an abstract base class that really wants to do something with the concrete |
I'm not really sure how your old code accomplished that since constructors are not inherited. Maybe your minimized code is now too small to clearly see what the use case was. Anyway it's probably better to ask the question on e.g. users.scala-lang.org. |
I can't think of a workaround that would cover all use cases.
|
You could consider
|
It doesn't: $ cat C.java && javac C.java
class C {
private final Class<?> cls;
C(Class<?> cls) {
this.cls = cls;
}
C() {
this(getClass());
}
}
C.java:9: error: cannot reference this before supertype constructor has been called
this(getClass());
^
1 error |
Indeed, the legacy code I'm now migrating to Scala 2.13 must have accidentally depended on the old 2.12 behavior where it invoked Thanks everyone for the quick reactions and answers! 👍 |
reproduction steps
using Scala (2.13.2),
problem
Fails to compile with
The above class compiles successfully with Scala 2.12.7.
The text was updated successfully, but these errors were encountered: