MethodHandle を使用するには、no-return-type: void を表す必要があります。Javaでは(はい、動作します)、scalaでは次を使用してvoid.class
取得できます。int.class
scala> classOf[Int]
res1: Class[Int] = int
、しかし、を使用するclassOf[Void]
と、
scala> val t = classOf[Void]
t: Class[Void] = class java.lang.Void
scala> t.isPrimitive
res4: Boolean = false
明らかにそうではありませんvoid.class
。