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
Traits + clone = boom! #151
Comments
Imported From: https://issues.scala-lang.org/browse/SI-151?orig=1 |
@dragos said: |
@odersky said: |
Kahli Burke (kahliburke) said: |
Andrzej Jozwik (ajozwik) said: // Java API
public interface JavaAPI {
JustSomeAPISpecificType clone();
} public enum JustSomeAPISpecificType{
INSTANCE
}
public class Factory {
public static class JavaApiImpl implements JavaAPI{
public JustSomeAPISpecificType clone(){
return JustSomeAPISpecificType.INSTANCE;
}
}
public static JavaAPI getAPI(){
return new JavaApiImpl();
}
} Test with sbt/scala console: scala> val api = Factory.getAPI
api: JavaAPI = Factory$JavaApiImpl@57a645
scala> api.clone
<console>:9: error: method clone in class Object cannot be accessed in JavaAPI
Access to protected method clone not permitted because
prefix type JavaAPI does not conform to
object $iw where the access take place
api.clone
|
Yaroslav Nedumov (yarnedumov) said: According to Andrzej Jozwik's last comment this bug is reproducible again (in Scala 2.10-2.12). I didn't test 2.10 and 2.12, but I can confirm it for Scala 2.11.8. |
please open a new ticket, reopening old tickets that regressed messes with milestones and such |
Run it and weep. All protected methods from a class that a trait extends need to be bridged, especially if the class is coming from Java.
The text was updated successfully, but these errors were encountered: