Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6CC18200B77 for ; Sat, 3 Sep 2016 09:06:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6B34A160ABB; Sat, 3 Sep 2016 07:06:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B41DA160AB9 for ; Sat, 3 Sep 2016 09:06:21 +0200 (CEST) Received: (qmail 56619 invoked by uid 500); 3 Sep 2016 07:06:20 -0000 Mailing-List: contact notifications-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list notifications@groovy.apache.org Received: (qmail 56606 invoked by uid 99); 3 Sep 2016 07:06:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Sep 2016 07:06:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 873CC2C014C for ; Sat, 3 Sep 2016 07:06:20 +0000 (UTC) Date: Sat, 3 Sep 2016 07:06:20 +0000 (UTC) From: "Cazacu Mihai (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (GROOVY-7927) Static type checking MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 03 Sep 2016 07:06:22 -0000 [ https://issues.apache.org/jira/browse/GROOVY-7927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15460559#comment-15460559 ] Cazacu Mihai edited comment on GROOVY-7927 at 9/3/16 7:05 AM: -------------------------------------------------------------- No, it is not a regression. We recently switched (manually modified hundreds of classes) from synchronous to async calls and we had to use a lot of this kind of code: {code} Function> asyncFct1 = { ... } Function> asyncFct2 = { ... } Function> asyncFct3 = { ... } chain(asyncFct1, asyncFct2, asyncFct3) { ... } {code} IntellijIdea did not find any syntax problems in code until we run it. If we remove _@CompileStatic_ annotation everything it works fine but I prefer do not do this. About ETA, it will be nice to have it ASAP. Until then we can comment that _@CompileStatic_. But, if you think that the fix of this issue will take some significant time, we will port our code (only the affected one) to Java (because of the performance reason). Thank you! was (Author: cazacugmihai): No, it is not a regression. We recently switched (manually modified hundreds of classes) from synchronous to async calls and we had to use a lot of this kind of code: {code} Function asyncFct1 = { ... } Function asyncFct2 = { ... } Function asyncFct3 = { ... } chain(asyncFct1, asyncFct2, asyncFct3) { ... } {code} IntellijIdea did not find any syntax problems in code until we run it. If we remove _@CompileStatic_ annotation everything it works fine but I prefer do not do this. About ETA, it will be nice to have it ASAP. Until then we can comment that _@CompileStatic_. But, if you think that the fix of this issue will take some significant time, we will port our code (only the affected one) to Java (because of the performance reason). Thank you! > Static type checking > -------------------- > > Key: GROOVY-7927 > URL: https://issues.apache.org/jira/browse/GROOVY-7927 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.4.7 > Reporter: Cazacu Mihai > > I have a problem running this code: > > {code:title=Test.groovy|borderStyle=solid} > import groovy.transform.CompileStatic > import java.util.function.Function > > @CompileStatic > class Test { > static void main(String[] args) { > // this code fails > Function fct = { Integer n -> > -n > } > > // this one works but it is too verbose > // Function fct = ({ Integer n -> > // -n > // } as Function) > > println fct.apply(10) > } > } > {code} > Error: > {quote} > Test.groovy: 9: [Static type checking] - Incompatible generic argument types. Cannot assign java.util.function.Function to: java.util.function.Function > @ line 9, column 36. > Function fct = { Integer n -> > ^ > 1 error > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)