3
我有一個接受Class
參數的Java方法。我需要通過Integer.class
,但從Kotlin代碼。我試過Int::class.java
,但是這不起作用,因爲int.class
被傳遞給函數。我的問題是,如何從Kotlin訪問Integer.class
。從Kotlin訪問Integer.class
的Java
void foo(Class clazz);
科特林
foo(Int::class.java) // does not work, int.class gets passed to foo
對於更多的細節可以參見[這裏](https://stackoverflow.com/questions/45397859/whats-the-behavior-of-iterableall-why-的確,科特林-charclass將-java的字符-JA/45400025#45400025)。 –