[ 
https://issues.apache.org/jira/browse/GROOVY-10745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles resolved GROOVY-10745.
----------------------------------
    Fix Version/s: 2.5.19
       Resolution: Fixed

https://github.com/apache/groovy/commit/12ec5065696fe400f4aae1f3412ec022c6d2fad8

> Type not captured correctly (regression in 2.5.18)
> --------------------------------------------------
>
>                 Key: GROOVY-10745
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10745
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.5.18
>            Reporter: Mauro Molinari
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 2.5.19
>
>
> Consider this:
> {code:groovy}
> package test2
> import groovy.transform.CompileStatic
> @CompileStatic
> class OptionalTest {
>     
>     void foo() {
>         Optional.of(bar()).orElse(Collections.emptyMap());
>     }
>     
>     Map bar() {
>         new HashMap()
>     }
> } {code}
> This compiles fine in 2.5.17, 2.5.16, etc., but fails with 2.5.18:
> {noformat}
> [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
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to