You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/08/20 15:59:58 UTC
[groovy] branch master updated (03b130d -> c7445cd)
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git.
from 03b130d GROOVY-10200: do not retain static for outer member checking of variable (closes #1613)
new 73c3e0f Format code
new c7445cd Trivial tweak: set the initial capacity of statement lists
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../codehaus/groovy/ast/stmt/TryCatchStatement.java | 4 ++--
.../java/org/codehaus/groovy/control/SourceUnit.java | 19 ++++++++++---------
2 files changed, 12 insertions(+), 11 deletions(-)
[groovy] 01/02: Format code
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 73c3e0f1c9e499049b8d4d9358be61ca371351f9
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Aug 20 23:57:08 2021 +0800
Format code
---
.../java/org/codehaus/groovy/control/SourceUnit.java | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/control/SourceUnit.java b/src/main/java/org/codehaus/groovy/control/SourceUnit.java
index 2568d6b..360cb26 100644
--- a/src/main/java/org/codehaus/groovy/control/SourceUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/SourceUnit.java
@@ -245,16 +245,17 @@ public class SourceUnit extends ProcessingUnit {
* Builds the AST.
*/
public ModuleNode buildAST() {
- if (this.ast == null)
- try {
- this.ast = parserPlugin.buildAST(this, this.classLoader, this.cst);
- this.ast.setDescription(this.name);
- } catch (SyntaxException e) {
- if (this.ast == null) {
- // create an empty ModuleNode to represent a failed parse, in case a later phase attempts to use the AST
- this.ast = new ModuleNode(this);
+ if (this.ast == null) {
+ try {
+ this.ast = parserPlugin.buildAST(this, this.classLoader, this.cst);
+ this.ast.setDescription(this.name);
+ } catch (SyntaxException e) {
+ if (this.ast == null) {
+ // create an empty ModuleNode to represent a failed parse, in case a later phase attempts to use the AST
+ this.ast = new ModuleNode(this);
+ }
+ getErrorCollector().addError(new SyntaxErrorMessage(e, this));
}
- getErrorCollector().addError(new SyntaxErrorMessage(e, this));
}
return this.ast;
}
[groovy] 02/02: Trivial tweak: set the initial capacity of
statement lists
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit c7445cdcf32f75ac6e471e7190d1b6820dbe206e
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Aug 20 23:59:12 2021 +0800
Trivial tweak: set the initial capacity of statement lists
---
src/main/java/org/codehaus/groovy/ast/stmt/TryCatchStatement.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/ast/stmt/TryCatchStatement.java b/src/main/java/org/codehaus/groovy/ast/stmt/TryCatchStatement.java
index e1c89e4..1efc095 100644
--- a/src/main/java/org/codehaus/groovy/ast/stmt/TryCatchStatement.java
+++ b/src/main/java/org/codehaus/groovy/ast/stmt/TryCatchStatement.java
@@ -33,8 +33,8 @@ import java.util.List;
public class TryCatchStatement extends Statement {
private static final String IS_RESOURCE = "_IS_RESOURCE";
private Statement tryStatement;
- private List<ExpressionStatement> resourceStatements = new ArrayList<>();
- private List<CatchStatement> catchStatements = new ArrayList<>();
+ private final List<ExpressionStatement> resourceStatements = new ArrayList<>(4);
+ private final List<CatchStatement> catchStatements = new ArrayList<>(4);
private Statement finallyStatement;