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 097DE200B6B for ; Fri, 9 Sep 2016 17:53:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 082FB160AD9; Fri, 9 Sep 2016 15:53:23 +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 560EE160AD5 for ; Fri, 9 Sep 2016 17:53:22 +0200 (CEST) Received: (qmail 44600 invoked by uid 500); 9 Sep 2016 15:53:21 -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 44579 invoked by uid 99); 9 Sep 2016 15:53:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2016 15:53:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 610242C014C for ; Fri, 9 Sep 2016 15:53:21 +0000 (UTC) Date: Fri, 9 Sep 2016 15:53:21 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-7926) Method that returns void in a Trait with generics produces questionable byte code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 09 Sep 2016 15:53:23 -0000 [ https://issues.apache.org/jira/browse/GROOVY-7926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15477391#comment-15477391 ] ASF GitHub Bot commented on GROOVY-7926: ---------------------------------------- Github user jwagenleitner commented on a diff in the pull request: https://github.com/apache/groovy/pull/416#discussion_r78203740 --- Diff: src/test/org/codehaus/groovy/transform/traitx/Groovy7926Bug.groovy --- @@ -0,0 +1,50 @@ +package org.codehaus.groovy.transform.traitx + +import org.codehaus.groovy.classgen.asm.AbstractBytecodeTestCase +import org.codehaus.groovy.classgen.asm.InstructionSequence + +/** + * Created by graemerocher on 08/09/2016. + */ +class Groovy7926Bug extends AbstractBytecodeTestCase { --- End diff -- Would probably be good to remove the class doc and add the license header. > Method that returns void in a Trait with generics produces questionable byte code > --------------------------------------------------------------------------------- > > Key: GROOVY-7926 > URL: https://issues.apache.org/jira/browse/GROOVY-7926 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.4.7 > Reporter: Graeme Rocher > > Given the following trait: > {code} > trait MyTrait { > void delete() { > // no-op > } > } > class MyImpl implements MyTrait { > } > {code} > The delete method produces byte code that when decompiled looks like: > {code} > public void delete() { > CallSite[] var1 = $getCallSiteArray(); > void var10000 = (void)var1[1].call(Helper.class, this); > } > {code} > As you can see "void" is used as a type of a variable. This results in the following exception on the IBM JVM (it works fine in Oracle and OpenJDK): > {code} > Caused by: java.lang.NoClassDefFoundError: void > at it.dedagroup.Test.delete(Test.groovy) > at org.grails.datastore.gorm.GormEntity$delete$0.call(Unknown Source) > at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) > {code} > Since the issue occurs only in IBM JVM it could be argued that this is a problem with that JVM, however the byte code produced does seem suspicious to me as "void" cannot be used as a type of a local variable. Thoughts? -- This message was sent by Atlassian JIRA (v6.3.4#6332)