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 25DC6200D5C for ; Fri, 15 Dec 2017 08:29:42 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 245C7160C14; Fri, 15 Dec 2017 07:29:42 +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 67355160C06 for ; Fri, 15 Dec 2017 08:29:41 +0100 (CET) Received: (qmail 8592 invoked by uid 500); 15 Dec 2017 07:29:40 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 8580 invoked by uid 99); 15 Dec 2017 07:29:40 -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; Fri, 15 Dec 2017 07:29:40 +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 D72B3180893 for ; Fri, 15 Dec 2017 07:29:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 rDPb6IDIDDOw for ; Fri, 15 Dec 2017 07:29:37 +0000 (UTC) Received: from mail-qk0-f173.google.com (mail-qk0-f173.google.com [209.85.220.173]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 650035F2EE for ; Fri, 15 Dec 2017 07:29:36 +0000 (UTC) Received: by mail-qk0-f173.google.com with SMTP id j207so9306095qke.10 for ; Thu, 14 Dec 2017 23:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=fOdxIpJlAoXuWYF4+8NwJPPUJ1pDUb78nWE8hid4aww=; b=jTEwbYz9WdFl6kS4DL38NnwtFjtYpH1r3q/iDOUnLFBnWSOm903nIcG1zcJMtOb4Ab EWVwKXQELn/kPmW9HwBhPHg8REzXIGlrpqYrAa7ArIKMW/M+z1QaLwAK1ootiNmvaPVB rgEtIpHPJN0OP0G8KIFafL2VV8eKh0MLgPBJOqyQxohkol0XJ+vIdZUrOpyQ1R0rnkCj QOF7oj8tMHokam/AtYufAq4YQBJ1OI+fpljQ7EbFE8gR6nbdzCkIrwW+QY+qh3aIatM3 70y79IG1+jExAqMjvaU3gOihSg1TTolh2jVeNlQkMSt6KVlDII5GIdfxS1+NAJBYpw8e Zl+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=fOdxIpJlAoXuWYF4+8NwJPPUJ1pDUb78nWE8hid4aww=; b=GNDyZiP7cVF1yri884Xj3DZSSbUu/VA+j9I8qGKYmd5huNxFcrS1ZOWeCPqn036hVj xqnz4w2QdSrZRTpif7MZJYqxmskLE1L96IBY4415ZkpTcHKk9wpHBGeN5qC3ObY2l99A /vcMyW8h8oNCu09Q5oLifRHamsE7NLV6vflMMHGaDUn9RsWIB33kFbD3++H48l/JEtij 5RnM2DeCK5YP/3jKnPE4rpNRKbxVXTmfexzUw6lFavpDX9DdwCAKqkbEL0Y250a/onJT oo45p3KWCxtqjt/lsUBGMYn8DbRIqJ/vgjN7xs/SVi46dNuESUK2KVkyK2hREJ0yGzlg Xufg== X-Gm-Message-State: AKGB3mL1/1kNh0Rp3OKVLmB17uQTT5G+0LF6K9NdklzdOQKp21Jw59Of MUtCW/e7tdVjpueyIQZDrDXQwUKq29blJKqpqEY= X-Google-Smtp-Source: ACJfBosDzC+jDjTGAvsFrPFRTio7acCthAxiZt/WQgQ5xwhpvdVUaOId76rGYb7b4lJu4+WwMyPH0mvT4d2OklorZ08= X-Received: by 10.55.150.1 with SMTP id y1mr20367287qkd.159.1513322968921; Thu, 14 Dec 2017 23:29:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.8.73 with HTTP; Thu, 14 Dec 2017 23:28:48 -0800 (PST) In-Reply-To: <79fa31ae-9061-fcfd-a2fb-532fc8605304@arscreat.com> References: <79fa31ae-9061-fcfd-a2fb-532fc8605304@arscreat.com> From: Paolo Di Tommaso Date: Fri, 15 Dec 2017 08:28:48 +0100 Message-ID: Subject: Re: @CompileStatic null iteration To: users@groovy.apache.org Content-Type: multipart/alternative; boundary="94eb2c08b838fe3a1705605bf5ee" archived-at: Fri, 15 Dec 2017 07:29:42 -0000 --94eb2c08b838fe3a1705605bf5ee Content-Type: text/plain; charset="UTF-8" Just found the same problem. This difference can introduce subtle bugs when refactoring groovy code to CompileStatic. I suggest to report a bug for that. Cheers, Paolo On Tue, Dec 12, 2017 at 12:45 AM, MG wrote: > Hi guys, > > just a quick question since we came across it today when testing code that > had been converted from dynamic to static Groovy: Is the behavior that > statically compiled Groovy throws a NPE when the iterable to be iterated > over is null (same as Java), while dynamically compiled Groovy uses the > NullObject.iterator(), i.e. does not throw but instead iterates over an > empty collection by design ? > > Cheers, > mg > > > --94eb2c08b838fe3a1705605bf5ee Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Just found the same problem. This difference can introduce= subtle bugs when refactoring groovy code to CompileStatic.=C2=A0

<= /div>
I suggest to report a bug for that.=C2=A0


Cheers, Paolo
=C2=A0=C2=A0

On Tue, Dec 12, 2017 at 12:= 45 AM, MG <mgbiz@arscreat.com> wrote:
Hi guys,

just a quick question since we came across it today when testing code that = had been converted from dynamic to static Groovy: Is the behavior that stat= ically compiled Groovy throws a NPE when the iterable to be iterated over i= s null (same as Java), while dynamically compiled Groovy uses the NullObjec= t.iterator(), i.e. does not throw but instead iterates over an empty collec= tion by design ?

Cheers,
mg



--94eb2c08b838fe3a1705605bf5ee--