From commits-return-9679-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Tue Nov 5 16:50:04 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 68769180668 for ; Tue, 5 Nov 2019 17:50:04 +0100 (CET) Received: (qmail 90074 invoked by uid 500); 5 Nov 2019 16:50:03 -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 89968 invoked by uid 99); 5 Nov 2019 16:50:03 -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; Tue, 05 Nov 2019 16:50:03 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 0C1EC805F6; Tue, 5 Nov 2019 16:50:03 +0000 (UTC) Date: Tue, 05 Nov 2019 16:50:03 +0000 To: "commits@groovy.apache.org" Subject: [groovy] 01/02: minor edits MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: sunlan@apache.org In-Reply-To: <157297260283.15833.16632397820309590126@gitbox.apache.org> References: <157297260283.15833.16632397820309590126@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: groovy X-Git-Refname: refs/heads/GROOVY_3_0_X X-Git-Reftype: branch X-Git-Rev: 0a131d8378716387a10e1abe5c6bd93deb687099 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20191105165003.0C1EC805F6@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit 0a131d8378716387a10e1abe5c6bd93deb687099 Author: Eric Milles AuthorDate: Tue Nov 5 09:47:45 2019 -0600 minor edits (cherry picked from commit 5744d8c71d4b7a9784499f484409137ae1d652d4) --- .../codehaus/groovy/classgen/ExtendedVerifier.java | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/classgen/ExtendedVerifier.java b/src/main/java/org/codehaus/groovy/classgen/ExtendedVerifier.java index 520ef4f..3402886 100644 --- a/src/main/java/org/codehaus/groovy/classgen/ExtendedVerifier.java +++ b/src/main/java/org/codehaus/groovy/classgen/ExtendedVerifier.java @@ -172,7 +172,7 @@ public class ExtendedVerifier extends ClassCodeVisitorSupport { if (!visited.hasSourceRetention()) { List seen = nonSourceAnnotations.get(name); if (seen == null) { - seen = new ArrayList(); + seen = new ArrayList<>(); } seen.add(visited); nonSourceAnnotations.put(name, seen); @@ -182,8 +182,7 @@ public class ExtendedVerifier extends ClassCodeVisitorSupport { // Check if the annotation target is correct, unless it's the target annotating an annotation definition // defining on which target elements the annotation applies if (!isTargetAnnotation && !visited.isTargetAllowed(target)) { - addError("Annotation @" + name + " is not allowed on element " - + AnnotationNode.targetToName(target), visited); + addError("Annotation @" + name + " is not allowed on element " + AnnotationNode.targetToName(target), visited); } visitDeprecation(node, visited); visitOverride(node, visited); @@ -196,17 +195,12 @@ public class ExtendedVerifier extends ClassCodeVisitorSupport { if (next.getValue().size() > 1) { ClassNode repeatable = null; AnnotationNode repeatee = next.getValue().get(0); - List repeateeAnnotations = repeatee.getClassNode().getAnnotations(); - for (AnnotationNode anno : repeateeAnnotations) { - ClassNode annoClassNode = anno.getClassNode(); - if (annoClassNode.getName().equals("java.lang.annotation.Repeatable")) { + for (AnnotationNode anno : repeatee.getClassNode().getAnnotations()) { + if (anno.getClassNode().getName().equals("java.lang.annotation.Repeatable")) { Expression value = anno.getMember("value"); - if (value instanceof ClassExpression) { - ClassExpression ce = (ClassExpression) value; - if (ce.getType() != null && ce.getType().isAnnotationDefinition()) { - repeatable = ce.getType(); - break; - } + if (value instanceof ClassExpression && value.getType().isAnnotationDefinition()) { + repeatable = value.getType(); + break; } } } @@ -226,11 +220,12 @@ public class ExtendedVerifier extends ClassCodeVisitorSupport { } } - List annos = new ArrayList(); + List annos = new ArrayList<>(); for (AnnotationNode an : next.getValue()) { annos.add(new AnnotationConstantExpression(an)); } collector.addMember("value", new ListExpression(annos)); + node.addAnnotation(collector); node.getAnnotations().removeAll(next.getValue()); }