Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.0-alpha-3
-
None
-
None
Description
Consider the following:
import java.util.function.* Supplier<String> s = () -> 'hello' print s.get() Consumer<String> c = x -> print x; c.accept(' ') Function<Integer, String> f = (Integer i) -> { 'world' } print f(42)
This script prints "hello world" under Groovy 3 but fails at runtime under Groovy 4 with exception:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'interface java.util.function.Consumer' with class 'java.lang.Class' to class 'java.util.function.Consumer'