Skip to content

Commit 8dbfc19

Browse files
committed
Fixed ArgumentHolder auto-casting constructor invocation (void type to object type).
1 parent 766261c commit 8dbfc19

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ buildscript {
1818
}
1919

2020
group 'com.github.jonathanxd'
21-
version '3.0.2-b'
21+
version '3.0.2-c'
2222

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

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ package com.github.jonathanxd.codeapi.bytecode.gen.visitor
2929

3030
import com.github.jonathanxd.codeapi.CodeAPI
3131
import com.github.jonathanxd.codeapi.CodePart
32+
import com.github.jonathanxd.codeapi.Types
3233
import com.github.jonathanxd.codeapi.base.Cast
3334
import com.github.jonathanxd.codeapi.bytecode.BytecodeClass
3435
import com.github.jonathanxd.codeapi.bytecode.common.MVData
@@ -82,6 +83,10 @@ object CastVisitor : VoidVisitor<Cast, BytecodeClass, MVData> {
8283
if (from.isArray || to.isArray)
8384
return null
8485

86+
// No autoboxing for void types
87+
if(!from.`is`(to) && from.`is`(Types.VOID) || to.`is`(Types.VOID))
88+
return null
89+
8590
if (from.isPrimitive && !to.isPrimitive) {
8691

8792
translate = CodeAPI.invokeConstructor(from.wrapperType, CodeAPI.constructorTypeSpec(from), listOf(casted))

0 commit comments

Comments
 (0)