groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Boudnik <...@apache.org>
Subject Re: Functional interfaces and CompileStatic
Date Fri, 08 Dec 2017 07:55:02 GMT
Yup,

Apache mailing lists do not accept attachments.
--
  With regards,
Konstantin (Cos) Boudnik
2CAC 8312 4870 D885 8616  6115 220F 6980 1F27 E622

Disclaimer: Opinions expressed in this email are those of the author,
and do not necessarily represent the views of any company the author
might be affiliated with at the moment of writing.


On Thu, Dec 7, 2017 at 10:39 PM, Nathan Harvey <nathanwharvey@gmail.com> wrote:
> Apologies, the mailing list removed my code (forum, anyone?). Here it is:
>
> @CompileStatic
> class SampleClass {
>         public void sample(Consumer<String> consumer) {}
>         public static void main(String[] args) {
>                 new SampleClass().sample({ String str -> str.toUpperCase() }) // passes
>                 new SampleClass().sample({ it.toUpperCase() }) // passes
>                 new SampleClass().sample({ str -> it.toUpperCase() }) // fails
>         }
> }
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Mime
View raw message