We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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> val oops: Any { def +(a: Int): Any } = 42 oops: Any{def +(a: Int): Any} = 42
This works because Int has a method def +(a: Int): Int and Int <: Any. But when you try to use it, you get a NoSuchMethodException:
Int
def +(a: Int): Int
Int <: Any
NoSuchMethodException
scala> import scala.language.reflectiveCalls import scala.language.reflectiveCalls scala> oops + 5 java.lang.NoSuchMethodException: java.lang.Integer.$plus(int) at java.lang.Class.getMethod(Class.java:1786) at .reflMethod$Method1(<console>:14) ... 39 elided
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-10175?orig=1 Reporter: Jasper-M Affected Versions: 2.12.1 See #9919, #192
Sorry, something went wrong.
@SethTisue said: Is this not a duplicate of SI-9919?
Jasper-M said: I wasn't sure. It's at least very strongly related.
@SethTisue said: (Let's assume they're basically the same thing unless we're pretty sure they're not.)
No branches or pull requests
This works because
Int
has a methoddef +(a: Int): Int
andInt <: Any
.But when you try to use it, you get a
NoSuchMethodException
:The text was updated successfully, but these errors were encountered: