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 EDDBA200BA3 for ; Thu, 6 Oct 2016 01:17:21 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EC81E160ADE; Wed, 5 Oct 2016 23:17:21 +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 61BEF160AEA for ; Thu, 6 Oct 2016 01:17:21 +0200 (CEST) Received: (qmail 66974 invoked by uid 500); 5 Oct 2016 23:17: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 66964 invoked by uid 99); 5 Oct 2016 23:17:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2016 23:17:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 6A9742C002D for ; Wed, 5 Oct 2016 23:17:20 +0000 (UTC) Date: Wed, 5 Oct 2016 23:17:20 +0000 (UTC) From: "Paul King (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (GROOVY-7960) IntRange iterator returns null instead of NoSuchElementException MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 05 Oct 2016 23:17:22 -0000 [ https://issues.apache.org/jira/browse/GROOVY-7960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King updated GROOVY-7960: ------------------------------ Labels: breaking (was: ) > IntRange iterator returns null instead of NoSuchElementException > ---------------------------------------------------------------- > > Key: GROOVY-7960 > URL: https://issues.apache.org/jira/browse/GROOVY-7960 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.4.7 > Reporter: John Wagenleitner > Assignee: John Wagenleitner > Priority: Minor > Labels: breaking > > Calling {{next()}} on an {{IntRange}} iterator returns {{null}} when {{hasNext{}}} returns false. As stated in a comment in the class, it should throw {{NoSuchElementException}} to adhere to the Iterator contract. > {code} > class IntRangeItrTest extends GroovyTestCase { > void testItr() { > def itr = (1..2).iterator() > assert itr.next() == 1 > assert itr.next() == 2 > assert !itr.hasNext() > shouldFail(NoSuchElementException) { > itr.next() // null > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)