From commits-return-7034-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Thu Jul 5 04:43:16 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 DB1B7180608 for ; Thu, 5 Jul 2018 04:43:15 +0200 (CEST) Received: (qmail 53879 invoked by uid 500); 5 Jul 2018 02:43:14 -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 53870 invoked by uid 99); 5 Jul 2018 02:43:14 -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; Thu, 05 Jul 2018 02:43:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AF448DFB1A; Thu, 5 Jul 2018 02:43:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sunlan@apache.org To: commits@groovy.apache.org Message-Id: <4436db5bd96e4ad3ae36d5d69c052008@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: groovy git commit: Validate expression list stricter Date: Thu, 5 Jul 2018 02:43:14 +0000 (UTC) Repository: groovy Updated Branches: refs/heads/master e80f794c8 -> 40269f772 Validate expression list stricter code like `foo(String a)` can be parsed as command expression in the parentheses, we should resolve the ambiguity strictly. Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/40269f77 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/40269f77 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/40269f77 Branch: refs/heads/master Commit: 40269f772e781b577ba5c60cd8180df5aa3bd506 Parents: e80f794 Author: sunlan Authored: Thu Jul 5 10:42:52 2018 +0800 Committer: sunlan Committed: Thu Jul 5 10:43:09 2018 +0800 ---------------------------------------------------------------------- .../src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/40269f77/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java ---------------------------------------------------------------------- diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java index c1bee5c..47863f0 100644 --- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java +++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java @@ -3496,7 +3496,7 @@ public class AstBuilder extends GroovyParserBaseVisitor implements Groov // statements like `foo(String a)` is invalid MethodCallExpression methodCallExpression = (MethodCallExpression) expression; String methodName = methodCallExpression.getMethodAsString(); - if (Character.isUpperCase(methodName.codePointAt(0)) || PRIMITIVE_TYPE_SET.contains(methodName)) { + if (methodCallExpression.isImplicitThis() && Character.isUpperCase(methodName.codePointAt(0)) || PRIMITIVE_TYPE_SET.contains(methodName)) { throw createParsingFailedException("Invalid method declaration", ctx); } }