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 2020/06/21 23:51:12 UTC

[groovy] branch master updated: GROOVY-9592: Replace "groovy.generate.stub.in.memory" with "groovy.mem.stub"

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 44dfe02  GROOVY-9592: Replace "groovy.generate.stub.in.memory" with "groovy.mem.stub"
44dfe02 is described below

commit 44dfe02cea62f482c7fb845f296c86106b791186
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Jun 14 08:31:43 2020 +0800

    GROOVY-9592: Replace "groovy.generate.stub.in.memory" with "groovy.mem.stub"
---
 .../org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java | 8 +++++---
 .../org/codehaus/groovy/control/CompilerConfigurationTest.java    | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java b/src/main/java/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java
index cce5faf..dd58618 100644
--- a/src/main/java/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java
+++ b/src/main/java/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java
@@ -73,12 +73,14 @@ public class JavaAwareCompilationUnit extends CompilationUnit {
             String sourceEncoding = this.configuration.getSourceEncoding();
             Object memStub = options.get(CompilerConfiguration.MEM_STUB);
             if (memStub == null) {
-                memStub = SystemUtil.getSystemPropertySafe("groovy.generate.stub.in.memory", "false");
-                options.put(CompilerConfiguration.MEM_STUB, Boolean.parseBoolean((String) memStub));
+                memStub = Boolean.parseBoolean(SystemUtil.getSystemPropertySafe("groovy.mem.stub", "false"))
+                                // the following JVM option will be removed since Groovy 4
+                            || Boolean.parseBoolean(SystemUtil.getSystemPropertySafe("groovy.generate.stub.in.memory", "false"));
+                options.put(CompilerConfiguration.MEM_STUB, memStub);
             }
 
             this.keepStubs = Boolean.TRUE.equals(options.get("keepStubs"));
-            this.memStubEnabled = Boolean.parseBoolean(memStub.toString());
+            this.memStubEnabled = Boolean.TRUE.equals(memStub);
             this.generationGoal = memStubEnabled ? null : (File) options.get("stubDir");
             this.stubGenerator = new JavaStubGenerator(generationGoal, false, atLeastJava5, sourceEncoding);
         }
diff --git a/src/test/org/codehaus/groovy/control/CompilerConfigurationTest.java b/src/test/org/codehaus/groovy/control/CompilerConfigurationTest.java
index af3308f..c1db59e 100644
--- a/src/test/org/codehaus/groovy/control/CompilerConfigurationTest.java
+++ b/src/test/org/codehaus/groovy/control/CompilerConfigurationTest.java
@@ -74,6 +74,7 @@ public final class CompilerConfigurationTest {
     public void testSetViaSystemProperties() {
         System.setProperty("groovy.warnings", "PaRaNoiA");
         System.setProperty("groovy.output.verbose", "trUE");
+        System.setProperty("groovy.mem.stub", "true");
         System.setProperty("groovy.generate.stub.in.memory", "true");
         System.setProperty("groovy.recompile.minimumInterval", "867892345");