Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
4.0.17
-
None
-
None
Description
I have the following code:
import groovy.transform.CompileStatic @CompileStatic static void main(String[] args) { println(new Person("John", 42).size()) } @CompileStatic record Person(String name, int age) {}
When checking the compiled output, the size method performs unnecessary boxing:
@Generated public final int size() { return Integer.valueOf(2); }
// access flags 0x11 public final size()I @Lgroovy/transform/Generated;() L0 ICONST_2 INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; INVOKEVIRTUAL java/lang/Integer.intValue ()I IRETURN L1 LOCALVARIABLE this Lorg/example/Person; L0 L1 0 MAXSTACK = 1 MAXLOCALS = 1