You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/30 17:09:00 UTC

[jira] [Updated] (GROOVY-9910) STC: no error for incorrect parameter type if not referenced in lambda

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

Eric Milles updated GROOVY-9910:
--------------------------------
    Priority: Minor  (was: Major)

> STC: no error for incorrect parameter type if not referenced in lambda
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-9910
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9910
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Priority: Minor
>
> Follow up to GROOVY-9790.  If a lambda expression does not reference one of its parameters, no inferred type metadata is written to the parameter and the boostrap error can still occur.
> Consider the following:
> {code:groovy}
>             @groovy.transform.CompileStatic
>             void test1() {
>                 java.util.stream.IntStream.range(0, 2).forEach(
>                     (Integer i) -> {  } // no reference to "i"
>                 )
>             }
>             @groovy.transform.CompileStatic
>             void test2() {
>                 java.util.stream.IntStream.range(0, 2).forEach(
>                     (String s) -> { assert false } // no reference to "s"
>                 )
>             }
> {code}
> 9790 fixes depend of the inferred type of a variable expression being written back to accessed variable (the parameter).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)