From notifications-return-14818-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Tue Dec 11 03:14:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 348B8180627 for ; Tue, 11 Dec 2018 03:14:05 +0100 (CET) Received: (qmail 18168 invoked by uid 500); 11 Dec 2018 02:14:04 -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 18158 invoked by uid 99); 11 Dec 2018 02:14:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2018 02:14:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id DABA318057D for ; Tue, 11 Dec 2018 02:14:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 17FZ3aoGneeP for ; Tue, 11 Dec 2018 02:14:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 80E65610F4 for ; Tue, 11 Dec 2018 02:14:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8C3AAE2632 for ; Tue, 11 Dec 2018 02:14:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 7FCF9252FC for ; Tue, 11 Dec 2018 02:14:00 +0000 (UTC) Date: Tue, 11 Dec 2018 02:14:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-8917) Failed to infer parameter type of some SAM, e.g. BinaryOperator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GROOVY-8917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16715980#comment-16715980 ] ASF GitHub Bot commented on GROOVY-8917: ---------------------------------------- Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/837#discussion_r240451854 --- Diff: src/main/java/org/codehaus/groovy/classgen/asm/util/TypeUtil.java --- @@ -213,4 +220,15 @@ private static String makeRefDescription(String name) { long.class, Long.class, short.class, Short.class ); + + private static final Map PRIMITIVE_CLASSNODE_TO_WRAPPED_CLASSNODE_MAP = Maps.of( + ClassHelper.byte_TYPE, ClassHelper.Byte_TYPE, + ClassHelper.boolean_TYPE, ClassHelper.Boolean_TYPE, + ClassHelper.char_TYPE, ClassHelper.Character_TYPE, + ClassHelper.double_TYPE, ClassHelper.Double_TYPE, + ClassHelper.float_TYPE, ClassHelper.Float_TYPE, + ClassHelper.int_TYPE, ClassHelper.Integer_TYPE, + ClassHelper.long_TYPE, ClassHelper.Long_TYPE, + ClassHelper.short_TYPE, ClassHelper.Short_TYPE + ); --- End diff -- Gotcha. I will use the map you suggest instead. > Failed to infer parameter type of some SAM, e.g. BinaryOperator > --------------------------------------------------------------- > > Key: GROOVY-8917 > URL: https://issues.apache.org/jira/browse/GROOVY-8917 > Project: Groovy > Issue Type: Bug > Reporter: Daniel Sun > Assignee: Daniel Sun > Priority: Major > > {code:java} > import groovy.transform.CompileStatic > import java.util.stream.Collectors > import java.util.stream.Stream > > @CompileStatic > public class Test1 { > public static void main(String[] args) { > p(); > } > > public static void p() { > // If we do not explicitly declare the type of parameter, STC fails > assert 13 == [1, 2, 3].stream().reduce(7, (Integer r, Integer e) -> r + e); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)