@@ -47,12 +47,12 @@ val JcInst.enclosingClass
47
47
val JcInst .enclosingMethod
48
48
get() = this .location.method
49
49
50
- fun JcType.toJavaClass (classLoader : ClassLoader ): Class <* > =
50
+ fun JcType.toJavaClass (classLoader : ClassLoader , initialize : Boolean = true ): Class <* > =
51
51
when (this ) {
52
52
is JcPrimitiveType -> toJavaClass()
53
- is JcArrayType -> findClassInLoader(toJvmType(), classLoader)
54
- is JcClassType -> this .jcClass.toJavaClass(classLoader)
55
- else -> findClassInLoader(typeName, classLoader)
53
+ is JcArrayType -> findClassInLoader(toJvmType(), classLoader, initialize )
54
+ is JcClassType -> this .jcClass.toJavaClass(classLoader, initialize )
55
+ else -> findClassInLoader(typeName, classLoader, initialize )
56
56
}
57
57
58
58
private fun JcPrimitiveType.toJavaClass (): Class <* > {
@@ -104,11 +104,11 @@ fun JcType.toJcClass(): JcClassOrInterface? =
104
104
else -> error(" Unexpected type" )
105
105
}
106
106
107
- fun JcClassOrInterface.toJavaClass (classLoader : ClassLoader , initialize : Boolean = false ): Class <* > =
107
+ fun JcClassOrInterface.toJavaClass (classLoader : ClassLoader , initialize : Boolean = true ): Class <* > =
108
108
findClassInLoader(name, classLoader, initialize)
109
109
110
110
111
- fun findClassInLoader (name : String , classLoader : ClassLoader , initialize : Boolean = false ): Class <* > =
111
+ fun findClassInLoader (name : String , classLoader : ClassLoader , initialize : Boolean = true ): Class <* > =
112
112
try {
113
113
Class .forName(name, initialize, classLoader)
114
114
} catch (e: Throwable ) {
0 commit comments