Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.18
-
None
Description
Consider this:
package test2 import groovy.transform.CompileStatic @CompileStatic class OptionalTest { void foo() { Optional.of(bar()).orElse(Collections.emptyMap()); } Map bar() { new HashMap() } }
This compiles fine in 2.5.17, 2.5.16, etc., but fails with 2.5.18:
[Static type checking] - Cannot call java.util.Optional <java.util.Map>#orElse(java.util.Map) with arguments [java.lang.Object] @ line 9, column 3. Optional.of(bar()).orElse(Collections.emptyMap()); ^ 1 error
Attachments
Issue Links
- is related to
-
GROOVY-8409 Static compilation with generic function wrapping BiFunction causes GroovyCastException
- Closed
-
GROOVY-9915 STC: call to static method fails with incompatible generics error
- Closed