Avoid redundant String allocations in JvmDescriptorTypeWriter
In most cases, jvmCurrentTypeArrayLevel == 0 and we can just use `type` The change was initially suggested by @gorrus
This commit is contained in:
@@ -366,7 +366,12 @@ open class JvmDescriptorTypeWriter<T : Any>(private val jvmTypeFactory: JvmTypeF
|
||||
|
||||
protected fun writeJvmTypeAsIs(type: T) {
|
||||
if (jvmCurrentType == null) {
|
||||
jvmCurrentType = jvmTypeFactory.createFromString("[".repeat(jvmCurrentTypeArrayLevel) + jvmTypeFactory.toString(type))
|
||||
jvmCurrentType =
|
||||
if (jvmCurrentTypeArrayLevel > 0) {
|
||||
jvmTypeFactory.createFromString("[".repeat(jvmCurrentTypeArrayLevel) + jvmTypeFactory.toString(type))
|
||||
} else {
|
||||
type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user