Skip to content

Commit 044e122

Browse files
committed
Disabled cast of void types (resolves unnecessary 'checkcast' instructions to cast a Constructor Invocation to Expected Argument Type).
1 parent 6fc2ca7 commit 044e122

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ buildscript {
1818
}
1919

2020
group 'com.github.jonathanxd'
21-
version '3.0.2-d'
21+
version '3.0.2-e'
2222

2323
apply from: project(":CodeAPI").file("gradle/common.gradle")
2424

2525
dependencies {
2626
compile project(":CodeAPI")
27-
compile 'com.github.JonathanxD:BytecodeDisassembler:2.0-a'
27+
compile 'com.github.JonathanxD:BytecodeDisassembler:2.0.2'
2828
compile group: 'org.ow2.asm', name: 'asm-all', version: '5.1'
2929
testCompile project(path: ':CodeAPI', configuration: 'tests')
3030
}

src/main/kotlin/com/github/jonathanxd/codeapi/bytecode/gen/visitor/CastVisitor.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ object CastVisitor : VoidVisitor<Cast, BytecodeClass, MVData> {
4949
val from = t.originalType
5050
val to = t.targetType
5151

52+
// No cast of void types.
53+
if(from != null && !from.`is`(to) && from.`is`(Types.VOID) || to.`is`(Types.VOID))
54+
return
55+
5256
val castedPart = t.castedPart
5357

5458
val autoboxing = if (from != null) autoboxing(from, to, castedPart) else null

0 commit comments

Comments
 (0)