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
Scala 2.13.6 Breaks Compilation of Extending Java Interfaces Defining Clone as public #12466
Comments
Please have a look at scala/scala#9525 and let us know what you think afterwards. cc @lrytz @kynthus |
If it's caused by that, it seems to be an unintentional impact. Unlike the statement "They are all about overriding public or package-private Java members with protected, protected[something] or private[something] in Scala.", this is caused by the Java interface setting the visibility to public, contravening the Object type as protected. And unlike the fixes found for community builds, I don't see any way to work around this while still extending such a Java interface. |
Java interface A {
public Object clone();
} Scala class C extends A
The mssage seems correct to me, the concrete method overrides the abstract one, and it cannot have weaker access privileges. Java agrees, with
you get
|
I see now, I'll file a bug with ScalaMock to produce something that compiles. |
reproduction steps
using Scala 2.13.6,
results in
problem
In Scala 2.13.5 this compiles successfully. The above is a minimal reproduction; I actually face this problem using ScalaMock to mock
javax.naming.directory.Attribute
.The text was updated successfully, but these errors were encountered: