Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.6.0-alpha-3
-
None
-
None
Description
This code:
import groovy.transform.CompileStatic import java.util.stream.Collectors @CompileStatic class Main { static void main(String[] args) { assert [2, 3, 4] == [1, 2, 3].stream().map(e -> e.plus 1).collect(Collectors.toList()) } }
works and produces a native lambda with the following bytecode within it's doCall method:
INVOKESTATIC org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.plus (Ljava/lang/Number;Ljava/lang/Number;)Ljava/lang/Number;
but moving the @compileStatic to the main method only, results in the following error:
java.lang.NoSuchMethodError: java.lang.Number.plus(Ljava/lang/Number;)Ljava/lang/Number;
and the following bytecode in the doCall method:
INVOKESTATIC java/lang/Number.plus (Ljava/lang/Number;)Ljava/lang/Number;