I'm trying to take a private static
method from a Java class and invoke it in Scala. Here's the code I have so far:
val blockClass = classOf[Block]
val aMethod: Method = blockClass.getDeclaredMethod("a", Integer.TYPE, classOf[String], classOf[Block])
aMethod.setAccessible(true)
aMethod.invoke(null, 145, "anvil", anvilPatch)
When I try to compile this, however, I get this error:
Error: the result type of an implicit conversion must be more specific than AnyRef
aMethod.invoke(null, 145, "anvil", null)
^
That 145
is supposed to be a Java int
, and Integer.TYPE
is the only thing I could think of to get a Java int
.
Any ideas?
Aucun commentaire:
Enregistrer un commentaire