You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2019/04/20 14:20:17 UTC

[groovy] branch GROOVY_2_5_X updated: minor refactor: don't set configuration twice and use DEFAULT rather than creating a new one when none supplied

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 bb4530b  minor refactor: don't set configuration twice and use DEFAULT rather than creating a new one when none supplied
bb4530b is described below

commit bb4530b4e279f5cb9213e41b21437b5377040535
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Apr 20 23:43:04 2019 +1000

    minor refactor: don't set configuration twice and use DEFAULT rather than creating a new one when none supplied
---
 .../java/org/codehaus/groovy/control/ProcessingUnit.java     | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/ProcessingUnit.java b/src/main/java/org/codehaus/groovy/control/ProcessingUnit.java
index 66715a4..1621535 100644
--- a/src/main/java/org/codehaus/groovy/control/ProcessingUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/ProcessingUnit.java
@@ -57,15 +57,11 @@ public abstract class ProcessingUnit {
     /**
      * Initialize the ProcessingUnit to the empty state.
      */
-
-    public ProcessingUnit(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector er) {
-
+    public ProcessingUnit(final CompilerConfiguration configuration, final GroovyClassLoader classLoader, final ErrorCollector errorCollector) {
         this.phase = Phases.INITIALIZATION;
-        this.configuration = configuration;
-        this.setClassLoader(classLoader);
-        configure((configuration == null ? new CompilerConfiguration() : configuration));
-        if (er == null) er = new ErrorCollector(getConfiguration());
-        this.errorCollector = er;
+        setClassLoader(classLoader);
+        configure(configuration != null ? configuration : CompilerConfiguration.DEFAULT);
+        this.errorCollector = errorCollector != null ? errorCollector : new ErrorCollector(getConfiguration());
     }