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 176A5200D38 for ; Sun, 12 Nov 2017 23:29:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 14AEB160C05; Sun, 12 Nov 2017 22:29:57 +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 59E8A160BCB for ; Sun, 12 Nov 2017 23:29:56 +0100 (CET) Received: (qmail 11577 invoked by uid 500); 12 Nov 2017 22:29:55 -0000 Mailing-List: contact commits-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 commits@groovy.apache.org Received: (qmail 11568 invoked by uid 99); 12 Nov 2017 22:29:55 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Nov 2017 22:29:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 59E0ADFBCA; Sun, 12 Nov 2017 22:29:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulk@apache.org To: commits@groovy.apache.org Date: Sun, 12 Nov 2017 22:29:55 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] groovy git commit: GROOVY-8289: STC and default value in ctor is causing debugging error (closes #630) archived-at: Sun, 12 Nov 2017 22:29:57 -0000 Repository: groovy Updated Branches: refs/heads/master ce5c639d5 -> a714e2025 GROOVY-8289: STC and default value in ctor is causing debugging error (closes #630) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/b9e3552e Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b9e3552e Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b9e3552e Branch: refs/heads/master Commit: b9e3552e0255958aafce9467f1372362a212f1a4 Parents: ce5c639 Author: paulk Authored: Tue Nov 7 17:37:16 2017 +1000 Committer: paulk Committed: Mon Nov 13 08:26:36 2017 +1000 ---------------------------------------------------------------------- .../groovy/classgen/AsmClassGenerator.java | 6 +-- src/test/groovy/bugs/Groovy8289Bug.groovy | 43 ++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/b9e3552e/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java ---------------------------------------------------------------------- diff --git a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java index 0e18e08..d3f0939 100644 --- a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java +++ b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java @@ -434,6 +434,9 @@ public class AsmClassGenerator extends ClassGenerator { } private void visitStdMethod(MethodNode node, boolean isConstructor, Parameter[] parameters, Statement code) { + controller.getCompileStack().init(node.getVariableScope(), parameters); + controller.getCallSiteWriter().makeSiteEntry(); + MethodVisitor mv = controller.getMethodVisitor(); final ClassNode superClass = controller.getClassNode().getSuperClass(); if (isConstructor && (code == null || !((ConstructorNode) node).firstStatementIsSpecialConstructorCall())) { @@ -463,9 +466,6 @@ public class AsmClassGenerator extends ClassGenerator { } } - controller.getCompileStack().init(node.getVariableScope(), parameters); - controller.getCallSiteWriter().makeSiteEntry(); - // handle body super.visitConstructorOrMethod(node, isConstructor); http://git-wip-us.apache.org/repos/asf/groovy/blob/b9e3552e/src/test/groovy/bugs/Groovy8289Bug.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/bugs/Groovy8289Bug.groovy b/src/test/groovy/bugs/Groovy8289Bug.groovy new file mode 100644 index 0000000..2091f66 --- /dev/null +++ b/src/test/groovy/bugs/Groovy8289Bug.groovy @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package groovy.bugs + +import org.codehaus.groovy.classgen.asm.AbstractBytecodeTestCase + +class Groovy8289Bug extends AbstractBytecodeTestCase { + void testConstructorLineIndex() { + def bytecode= compile(method:'', ''' + @groovy.transform.CompileStatic + class C { + String string + C(String s = null) { string = s } + static void main(args) { + def c = new C('') // put breakpoint on this line, run as Java app, and step + println c + } + } + ''') + + assert bytecode.hasStrictSequence([ + 'L0', + 'ALOAD 0', + 'INVOKESPECIAL java/lang/Object. ()V' + ]) + } +}