From dev-return-5454-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Sat Sep 29 22:35:29 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 098B9180672 for ; Sat, 29 Sep 2018 22:35:28 +0200 (CEST) Received: (qmail 643 invoked by uid 500); 29 Sep 2018 20:35:28 -0000 Mailing-List: contact dev-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 dev@groovy.apache.org Received: (qmail 633 invoked by uid 99); 29 Sep 2018 20:35:27 -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; Sat, 29 Sep 2018 20:35:27 +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 152B5180ADB for ; Sat, 29 Sep 2018 20:35:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3 X-Spam-Level: *** X-Spam-Status: No, score=3 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_NONE=-0.0001] 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 r4En3e0z28nm for ; Sat, 29 Sep 2018 20:35:25 +0000 (UTC) Received: from homiemail-a79.g.dreamhost.com (sub5.mail.dreamhost.com [208.113.200.129]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 1A7095F3AC for ; Sat, 29 Sep 2018 20:35:25 +0000 (UTC) Received: from homiemail-a79.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a79.g.dreamhost.com (Postfix) with ESMTP id 552BE600682A for ; Sat, 29 Sep 2018 13:35:23 -0700 (PDT) Received: from [192.168.1.130] (c-71-192-16-240.hsd1.ma.comcast.net [71.192.16.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: keith@suderman.com) by homiemail-a79.g.dreamhost.com (Postfix) with ESMTPSA id D3764600656D for ; Sat, 29 Sep 2018 13:35:22 -0700 (PDT) From: Keith Suderman Content-Type: multipart/signed; boundary="Apple-Mail=_FB5AEAEF-3BF0-4F26-9CEA-5EE126C2318A"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Bug or expected behaviour? Message-Id: <8B432B51-A5B8-4637-A728-57EC6F3DCF67@cs.vassar.edu> Date: Sat, 29 Sep 2018 16:35:21 -0400 To: dev@groovy.apache.org X-Mailer: Apple Mail (2.3445.6.18) --Apple-Mail=_FB5AEAEF-3BF0-4F26-9CEA-5EE126C2318A Content-Type: multipart/alternative; boundary="Apple-Mail=_A9C38B4D-D441-45E2-B3F4-C442F84A01E4" --Apple-Mail=_A9C38B4D-D441-45E2-B3F4-C442F84A01E4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hello, I have a parent class that defines a static final String and a child = class that references the String in it's constructor. Essentially: class Parent { static final String DEFAULT =3D 'default' } class Child extends Parent { String value Child() { this(DEFAULT) } // Bad type on operand stack Child(String value) { this.value =3D value } } println new Child().value However, when I try to run the code I get a "java.lang.VerifyError: Bad = type on operand stack" (see below). =46rom my understanding this = exception is caused when a constructor tries to use a variable/field = that has not been initialized yet; i.e. the `this(DEFAULT)` in the above = example. However, if I qualify the DEFAULT with the class name (i.e. = `this(Parent.DEFAULT)`) the code works as expected. Similar code in Java works without DEFAULT being qualified with the = superclass name. So I am wondering; is this a bug or a design decision = that was made somewhere/sometime? I am using Groovy Version: 2.5.2 JVM: 1.8.0_40 Vendor: Oracle = Corporation OS: Mac OS X Cheers, Keith Caught: java.lang.VerifyError: Bad type on operand stack Exception Details: Location: Child.()V @10: invokeinterface Reason: Type uninitializedThis (current frame, stack[2]) is not assignable to = 'java/lang/Object' Current Frame: bci: @10 flags: { flagThisUninit } locals: { uninitializedThis, = '[Lorg/codehaus/groovy/runtime/callsite/CallSite;' } stack: { uninitializedThis, = 'org/codehaus/groovy/runtime/callsite/CallSite', uninitializedThis } Bytecode: 0x0000000: b800 114c 2a2b 1212 322a b900 1802 00b8 0x0000010: 001e c000 20b7 0023 b1 ---------------------- Keith Suderman Research Associate Department of Computer Science Vassar College, Poughkeepsie NY suderman@cs.vassar.edu --Apple-Mail=_A9C38B4D-D441-45E2-B3F4-C442F84A01E4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Hello,

I have a parent class = that defines a static final String and a child class that references the = String in it's constructor.  Essentially:

class Parent { 
static = final String DEFAULT =3D 'default' 
}
class Child extends Parent {
String = value
Child() { this(DEFAULT) }  // Bad type on operand = stack
Child(String value) { this.value =3D value }
}
println new Child().value

However, when I try to run the code I get a = "java.lang.VerifyError: Bad type on operand stack" (see below). =  =46rom my understanding this exception is caused when a = constructor tries to use a variable/field that has not been initialized = yet; i.e. the `this(DEFAULT)` in the above example.  However, if I = qualify the DEFAULT with the class name (i.e. `this(Parent.DEFAULT)`) = the code works as expected.

Similar code in = Java works without DEFAULT being qualified with the superclass name. =  So I am wondering; is this a bug or a design decision that was = made somewhere/sometime?  

I am using = Groovy Version: 2.5.2 JVM: 1.8.0_40 Vendor: Oracle Corporation OS: Mac = OS X

Cheers,
Keith

Caught: java.lang.VerifyError: Bad type on = operand stack
Exception Details:
 Location:
   Child.<init>()V @10: = invokeinterface
 Reason:
   Type uninitializedThis (current frame, = stack[2]) is not assignable to 'java/lang/Object'
 Current Frame:
   bci: = @10
   flags: { flagThisUninit }
   locals: { uninitializedThis, = '[Lorg/codehaus/groovy/runtime/callsite/CallSite;' }
   stack: { uninitializedThis, = 'org/codehaus/groovy/runtime/callsite/CallSite', uninitializedThis }
 Bytecode:
   0x0000000: = b800 114c 2a2b 1212 322a b900 1802 00b8
   0x0000010: 001e c000 20b7 0023 b1 =   

----------------------
Keith = Suderman
Research Associate
Department of Computer = Science
Vassar = College, Poughkeepsie NY




= --Apple-Mail=_A9C38B4D-D441-45E2-B3F4-C442F84A01E4-- --Apple-Mail=_FB5AEAEF-3BF0-4F26-9CEA-5EE126C2318A Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEpdptCFpJ9QjhG2R05vJXHN7+jcAFAluv4gkACgkQ5vJXHN7+ jcASMAf+OaSmG73Vuvj5vFimtAtXIwtFdbPvIv9M1pKbTwkbEQFMwaKsRNqVqrLy onh1CuytmVoWLOQHjv1PBm1rOC+JFDp5przFaVf5m+QWr4HFQ1ypqztf+Zqcm8zH XuEunCStUnnn9fyBe1NpR6qp5ZYkDi8AoBKxzwMrUudZEQyETmFBPS4QwOFNFOjx 1fDyryAi1dZTLRHd+BZHYFlk6dgOQmV/cK/wEziwnlN8J4MomtI0yJMh7NqeI/oR UG7oeuOorS1LIlDskdX0N5mdBv+2aoP/SAGIAjpKW+yVlw3vkZHH9ja+tNp5fHQT OYBgzTqwZRX7aYcL9Gj06sb0EqyCfg== =sGqM -----END PGP SIGNATURE----- --Apple-Mail=_FB5AEAEF-3BF0-4F26-9CEA-5EE126C2318A--