From commits-return-8814-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Fri Jun 7 03:16:30 2019 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 [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 973A618062B for ; Fri, 7 Jun 2019 05:16:30 +0200 (CEST) Received: (qmail 50969 invoked by uid 500); 7 Jun 2019 03:16:29 -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 50960 invoked by uid 99); 7 Jun 2019 03:16:29 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jun 2019 03:16:29 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 709D58AC3A; Fri, 7 Jun 2019 03:16:24 +0000 (UTC) Date: Fri, 07 Jun 2019 03:16:24 +0000 To: "commits@groovy.apache.org" Subject: [groovy] branch GROOVY_2_5_X updated: GROOVY-9163: AutoExternalize AST transform (and others) mark user supplied read/write method as @Generated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155987738431.29451.139004116639291399@gitbox.apache.org> From: paulk@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: groovy X-Git-Refname: refs/heads/GROOVY_2_5_X X-Git-Reftype: branch X-Git-Oldrev: ba1f853175cc5676e46bb6da8f1cc757a22eff0a X-Git-Newrev: 7f8ffc4d5a5d749eef65e100dafabdec4116db63 X-Git-Rev: 7f8ffc4d5a5d749eef65e100dafabdec4116db63 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push: new 7f8ffc4 GROOVY-9163: AutoExternalize AST transform (and others) mark user supplied read/write method as @Generated 7f8ffc4 is described below commit 7f8ffc4d5a5d749eef65e100dafabdec4116db63 Author: Paul King AuthorDate: Fri Jun 7 11:35:29 2019 +1000 GROOVY-9163: AutoExternalize AST transform (and others) mark user supplied read/write method as @Generated --- .../java/org/apache/groovy/ast/tools/ClassNodeUtils.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java b/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java index daf60aa..0d61ea5 100644 --- a/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java +++ b/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java @@ -78,7 +78,7 @@ public class ClassNodeUtils { } /** - * Add a method that is marked as @Generated. + * Return an existing method if one exists or else create a new method and mark it as {@code @Generated}. * * @see ClassNode#addMethod(String, int, ClassNode, Parameter[], ClassNode[], Statement) */ @@ -88,13 +88,15 @@ public class ClassNodeUtils { Parameter[] parameters, ClassNode[] exceptions, Statement code) { - MethodNode result = cNode.addMethod(name, modifiers, returnType, parameters, exceptions, code); - markAsGenerated(cNode, result); + MethodNode existing = cNode.getDeclaredMethod(name, parameters); + if (existing != null) return existing; + MethodNode result = new MethodNode(name, modifiers, returnType, parameters, exceptions, code); + addGeneratedMethod(cNode, result); return result; } /** - * Add a method that is marked as @Generated. + * Add a method and mark it as {@code @Generated}. * * @see ClassNode#addMethod(MethodNode) */ @@ -104,7 +106,7 @@ public class ClassNodeUtils { } /** - * Add an inner class that is marked as @Generated. + * Add an inner class that is marked as {@code @Generated}. * * @see org.codehaus.groovy.ast.ModuleNode#addClass(ClassNode) */ @@ -114,7 +116,7 @@ public class ClassNodeUtils { } /** - * Add a method that is marked as @Generated. + * Add a method that is marked as {@code @Generated}. * * @see ClassNode#addConstructor(int, Parameter[], ClassNode[], Statement) */ @@ -125,7 +127,7 @@ public class ClassNodeUtils { } /** - * Add a method that is marked as @Generated. + * Add a method that is marked as {@code @Generated}. * * @see ClassNode#addConstructor(ConstructorNode) */