JVM optimize out temporary variables in bytecode
This commit is contained in:
committed by
TeamCityServer
parent
bddfd086f6
commit
041773fd25
+16
@@ -0,0 +1,16 @@
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface J {
|
||||
@NotNull
|
||||
public Integer foo();
|
||||
}
|
||||
|
||||
// FILE: safeCallToPrimitiveEquality3.kt
|
||||
|
||||
fun doJava1(s: String?, j: J) = s?.length == j.foo()
|
||||
|
||||
fun doJava2(s: String?, j: J) = j.foo() == s?.length
|
||||
|
||||
// `doJava1`/`doJava2` box `s?.length` instead of unboxing `j.foo()`:
|
||||
// 2 valueOf
|
||||
Reference in New Issue
Block a user