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/12/11 17:08:50 UTC
[groovy] branch master updated: Trivial refactoring: make field `final`
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
The following commit(s) were added to refs/heads/master by this push:
new 59e9e58 Trivial refactoring: make field `final`
59e9e58 is described below
commit 59e9e58e6be0f6784f2701a050bc76305e06f2e4
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Dec 12 01:08:22 2021 +0800
Trivial refactoring: make field `final`
---
.../src/main/groovy/groovy/text/StreamingTemplateEngine.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/subprojects/groovy-templates/src/main/groovy/groovy/text/StreamingTemplateEngine.java b/subprojects/groovy-templates/src/main/groovy/groovy/text/StreamingTemplateEngine.java
index cc07b2d..58dac81 100644
--- a/subprojects/groovy-templates/src/main/groovy/groovy/text/StreamingTemplateEngine.java
+++ b/subprojects/groovy-templates/src/main/groovy/groovy/text/StreamingTemplateEngine.java
@@ -148,9 +148,8 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public class StreamingTemplateEngine extends TemplateEngine {
private static final String TEMPLATE_SCRIPT_PREFIX = "StreamingTemplateScript";
-
+ private static final AtomicInteger COUNTER = new AtomicInteger(0);
private final ClassLoader parentLoader;
- private static AtomicInteger counter = new AtomicInteger(0);
/**
* Create a streaming template engine instance using the default class loader
@@ -600,7 +599,7 @@ public class StreamingTemplateEngine extends TemplateEngine {
final GroovyClassLoader loader = VMPluginFactory.getPlugin().doPrivileged((PrivilegedAction<GroovyClassLoader>) () -> new GroovyClassLoader(parentLoader));
final Class groovyClass;
try {
- groovyClass = loader.parseClass(new GroovyCodeSource(target.toString(), TEMPLATE_SCRIPT_PREFIX + counter.incrementAndGet() + ".groovy", "x"));
+ groovyClass = loader.parseClass(new GroovyCodeSource(target.toString(), TEMPLATE_SCRIPT_PREFIX + COUNTER.incrementAndGet() + ".groovy", "x"));
} catch (MultipleCompilationErrorsException e) {
throw mangleMultipleCompilationErrorsException(e, sections);