groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] 01/02: GROOVY-9073: added compiler option to enable preview features (JEP 12)
Date Thu, 25 Apr 2019 02:32:21 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 7b395f5a3a9f46ba3bf0edd6ce335746ac10d638
Author: Keegan Witt <keeganwitt@gmail.com>
AuthorDate: Mon Apr 8 14:36:09 2019 -0400

    GROOVY-9073: added compiler option to enable preview features (JEP 12)
---
 src/bin/groovyConsole_completion                   |  2 +-
 src/bin/groovy_completion                          |  2 +-
 src/bin/groovyc_completion                         |  2 +-
 src/bin/groovysh_completion                        |  2 +-
 src/main/groovy/groovy/ui/GroovyMain.java          |  4 +++
 .../groovy/classgen/AsmClassGenerator.java         |  2 +-
 .../groovy/classgen/asm/WriterController.java      |  8 +++---
 .../groovy/control/CompilerConfiguration.java      | 30 +++++++++++++++++++++-
 .../codehaus/groovy/tools/FileSystemCompiler.java  |  4 +++
 src/spec/doc/tools-groovy.adoc                     |  1 +
 src/spec/doc/tools-groovyc.adoc                    |  1 +
 .../main/java/org/codehaus/groovy/ant/Groovyc.java | 24 +++++++++++++++++
 .../groovy/cli/picocli/CliBuilderTest.groovy       | 24 +++++++++++++++--
 .../src/spec/doc/groovy-console.adoc               |  3 ++-
 .../groovy-groovysh/src/spec/doc/groovysh.adoc     |  3 ++-
 15 files changed, 98 insertions(+), 14 deletions(-)

diff --git a/src/bin/groovyConsole_completion b/src/bin/groovyConsole_completion
index 10c777c..9803661 100644
--- a/src/bin/groovyConsole_completion
+++ b/src/bin/groovyConsole_completion
@@ -90,7 +90,7 @@ function _picocli_groovyConsole() {
   PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
 
   COMMANDS=""
-  FLAG_OPTS="-cp -classpath --classpath -h --help -V --version -pa --parameters -i --indy"
+  FLAG_OPTS="-cp -classpath --classpath -h --help -V --version -pa --parameters -pr --enable-preview
-i --indy"
   ARG_OPTS="-D --define --configscript"
 
   COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
diff --git a/src/bin/groovy_completion b/src/bin/groovy_completion
index 13cd712..9fc1fa7 100644
--- a/src/bin/groovy_completion
+++ b/src/bin/groovy_completion
@@ -90,7 +90,7 @@ function _picocli_groovy() {
   PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
 
   COMMANDS=""
-  FLAG_OPTS="-d --debug -n -p -pa --parameters --indy -h --help -v --version"
+  FLAG_OPTS="-d --debug -n -p -pa --parameters -pr --enable-preview --indy -h --help -v --version"
   ARG_OPTS="-cp -classpath --classpath -D --define --disableopt -c --encoding -e -i -l -a
--autosplit --configscript -b --basescript"
 
   COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
diff --git a/src/bin/groovyc_completion b/src/bin/groovyc_completion
index ebb2a2a..d4591f1 100644
--- a/src/bin/groovyc_completion
+++ b/src/bin/groovyc_completion
@@ -90,7 +90,7 @@ function _picocli_groovyc() {
   PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
 
   COMMANDS=""
-  FLAG_OPTS="-e --exception -pa --parameters -j --jointCompilation --indy -h --help -v --version"
+  FLAG_OPTS="-e --exception -pa --parameters -pr --enable-preview -j --jointCompilation --indy
-h --help -v --version"
   ARG_OPTS="-cp -classpath --classpath -sourcepath --sourcepath --temp --encoding -d -b --basescript
-J -F --configscript"
 
   case ${CURR_WORD} in
diff --git a/src/bin/groovysh_completion b/src/bin/groovysh_completion
index 5b8869c..d3e4a8a 100644
--- a/src/bin/groovysh_completion
+++ b/src/bin/groovysh_completion
@@ -87,7 +87,7 @@ function _picocli_groovysh() {
   PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
 
   COMMANDS=""
-  FLAG_OPTS="-cp -classpath --classpath -h --help -V --version -v --verbose -q --quiet -d
--debug -pa --parameters"
+  FLAG_OPTS="-cp -classpath --classpath -h --help -V --version -v --verbose -q --quiet -d
--debug -pr --enable-preview -pr --parameters"
   ARG_OPTS="-e --evaluate -C --color -D --define -T --terminal"
 
   COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
diff --git a/src/main/groovy/groovy/ui/GroovyMain.java b/src/main/groovy/groovy/ui/GroovyMain.java
index 7bdf937..e6702e4 100644
--- a/src/main/groovy/groovy/ui/GroovyMain.java
+++ b/src/main/groovy/groovy/ui/GroovyMain.java
@@ -199,6 +199,9 @@ public class GroovyMain {
         @Option(names = {"-pa", "--parameters"}, description = "Generate metadata for reflection
on method parameter names (jdk8+ only)")
         private boolean parameterMetadata;
 
+        @Option(names = {"-pr", "--enable-preview"}, description = "Enable preview Java features
(JEP 12) (jdk12+ only)")
+        private boolean previewFeatures;
+
         @Option(names = "-l", arity = "0..1", paramLabel = "<port>", description =
"Listen on a port and process inbound lines (default: 1960)")
         private String port;
 
@@ -241,6 +244,7 @@ public class GroovyMain {
             main.debug = debug;
             main.conf.setDebug(main.debug);
             main.conf.setParameters(parameterMetadata);
+            main.conf.setPreviewFeatures(previewFeatures);
             main.processFiles = lineByLine || lineByLinePrint;
             main.autoOutput = lineByLinePrint;
             main.editFiles = extension != null;
diff --git a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
index d9bea88..6f6d217 100644
--- a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -221,7 +221,7 @@ public class AsmClassGenerator extends ClassGenerator {
             Object min = classNode.getNodeMetaData(MINIMUM_BYTECODE_VERSION);
             if (min instanceof Integer) {
                 int minVersion = (int) min;
-                if (bytecodeVersion < minVersion) {
+                if ((bytecodeVersion ^ Opcodes.V_PREVIEW) < minVersion) {
                     bytecodeVersion = minVersion;
                 }
             }
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java b/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
index ef27fff..1747f8b 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
@@ -98,7 +98,7 @@ public class WriterController {
         this.outermostClass = null;
         this.internalClassName = BytecodeHelper.getClassInternalName(classNode);
 
-        bytecodeVersion = chooseBytecodeVersion(invokedynamic, config.getTargetBytecode());
+        bytecodeVersion = chooseBytecodeVersion(invokedynamic, config.isPreviewFeatures(),
config.getTargetBytecode());
 
         if (invokedynamic) {
             this.invocationWriter = new InvokeDynamicWriter(this);
@@ -149,14 +149,14 @@ public class WriterController {
         }
         return new LoggableClassVisitor(cv);
     }
-    private static int chooseBytecodeVersion(final boolean invokedynamic, final String targetBytecode)
{
+    private static int chooseBytecodeVersion(final boolean invokedynamic, final boolean previewFeatures,
final String targetBytecode) {
         Integer bytecodeVersion = CompilerConfiguration.JDK_TO_BYTECODE_VERSION_MAP.get(targetBytecode);
 
         if (invokedynamic && bytecodeVersion < Opcodes.V1_8) {
-            return Opcodes.V1_8;
+            return previewFeatures ? Opcodes.V1_8 | Opcodes.V_PREVIEW : Opcodes.V1_8;
         } else {
             if (null != bytecodeVersion) {
-                return bytecodeVersion;
+                return previewFeatures ? bytecodeVersion | Opcodes.V_PREVIEW : bytecodeVersion;
             }
         }
 
diff --git a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
index 9e185ca..9cf01a7 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -208,6 +208,11 @@ public class CompilerConfiguration {
     private String targetBytecode;
 
     /**
+     * Whether the bytecode version has preview features enabled (JEP 12)
+     */
+    private boolean previewFeatures;
+
+    /**
      * options for joint compilation (null by default == no joint compilation)
      */
     private Map<String, Object> jointCompilationOptions;
@@ -243,7 +248,6 @@ public class CompilerConfiguration {
      * Sets the Flags to defaults.
      */
     public CompilerConfiguration() {
-        //
         // Set in safe defaults
 
         setWarningLevel(WarningMessage.LIKELY_ERRORS);
@@ -258,6 +262,7 @@ public class CompilerConfiguration {
         setRecompileGroovySource(false);
         setMinimumRecompilationInterval(100);
         setTargetBytecode(getSystemPropertySafe("groovy.target.bytecode", getMinBytecodeVersion()));
+        setPreviewFeatures(getSystemPropertySafe("groovy.preview.features") != null);
         setDefaultScriptExtension(getSystemPropertySafe("groovy.default.scriptExtension",
".groovy"));
 
         // Source file encoding
@@ -349,6 +354,7 @@ public class CompilerConfiguration {
         setRecompileGroovySource(configuration.getRecompileGroovySource());
         setMinimumRecompilationInterval(configuration.getMinimumRecompilationInterval());
         setTargetBytecode(configuration.getTargetBytecode());
+        setPreviewFeatures(configuration.isPreviewFeatures());
         setDefaultScriptExtension(configuration.getDefaultScriptExtension());
         setSourceEncoding(configuration.getSourceEncoding());
         setTargetDirectory(configuration.getTargetDirectory());
@@ -398,6 +404,7 @@ public class CompilerConfiguration {
      *      <tr><td><code>"groovy.source.encoding"</code></td><td>{@link
#getSourceEncoding}</td></tr>
      *      <tr><td><code>"groovy.target.directory"</code></td><td>{@link
#getTargetDirectory}</td></tr>
      *      <tr><td><code>"groovy.target.bytecode"</code></td><td>{@link
#getTargetBytecode}</td></tr>
+     *      <tr><td><code>"groovy.preview.features"</code></td><td>{@link
#isPreviewFeatures}</td></tr>
      *      <tr><td><code>"groovy.classpath"</code></td><td>{@link
#getClasspath}</td></tr>
      *      <tr><td><code>"groovy.output.verbose"</code></td><td>{@link
#getVerbose}</td></tr>
      *      <tr><td><code>"groovy.output.debug"</code></td><td>{@link
#getDebug}</td></tr>
@@ -511,6 +518,9 @@ public class CompilerConfiguration {
         text = configuration.getProperty("groovy.target.bytecode");
         if (text != null) setTargetBytecode(text);
 
+        text = configuration.getProperty("groovy.preview.features");
+        if (text != null && text.equalsIgnoreCase("true")) setPreviewFeatures(true);
+
         //
         // Classpath
         //
@@ -846,6 +856,24 @@ public class CompilerConfiguration {
         return this.targetBytecode;
     }
 
+    /**
+     * Whether the bytecode version has preview features enabled (JEP 12)
+     *
+     * @return preview features
+     */
+    public boolean isPreviewFeatures() {
+        return previewFeatures;
+    }
+
+    /**
+     * Sets whether the bytecode version has preview features enabled (JEP 12).
+     *
+     * @param previewFeatures whether to support preview features
+     */
+    public void setPreviewFeatures(boolean previewFeatures) {
+        this.previewFeatures = previewFeatures;
+    }
+
     private static String getMinBytecodeVersion() {
         return JDK8;
     }
diff --git a/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java b/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java
index 1c040cb..e197c6f 100644
--- a/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java
+++ b/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java
@@ -331,6 +331,9 @@ public class FileSystemCompiler {
         @Option(names = {"-pa", "--parameters"}, description = "Generate metadata for reflection
on method parameter names (jdk8+ only)")
         private boolean parameterMetadata;
 
+        @Option(names = {"-pr", "--enable-preview"}, description = "Enable preview Java features
(JEP 12) (jdk12+ only)")
+        private boolean previewFeatures;
+
         @Option(names = {"-j", "--jointCompilation"}, description = "Attach javac compiler
to compile .java files")
         private boolean jointCompilation;
 
@@ -372,6 +375,7 @@ public class FileSystemCompiler {
             }
 
             configuration.setParameters(parameterMetadata);
+            configuration.setPreviewFeatures(previewFeatures);
             configuration.setSourceEncoding(encoding);
             configuration.setScriptBaseClass(scriptBaseClass);
 
diff --git a/src/spec/doc/tools-groovy.adoc b/src/spec/doc/tools-groovy.adoc
index 50f578d..caf202c 100644
--- a/src/spec/doc/tools-groovy.adoc
+++ b/src/spec/doc/tools-groovy.adoc
@@ -60,4 +60,5 @@ int (disable any int based optimizations) |
 | -p | | process files line by line and print result (see also -n) |
 | -v | --version | display the Groovy and JVM versions | groovy -v
 | -pa | --parameters | Generates metadata for reflection on method parameter names on JDK
8 and above. Defaults to false. | groovy --parameters Person.groovy
+| -pr | --enable-preview | Enable preview Java features (JEP 12) (jdk12+ only). | groovy
--enable-preview Person.groovy
 |=======================================================================
diff --git a/src/spec/doc/tools-groovyc.adoc b/src/spec/doc/tools-groovyc.adoc
index db29911..7871561 100644
--- a/src/spec/doc/tools-groovyc.adoc
+++ b/src/spec/doc/tools-groovyc.adoc
@@ -52,6 +52,7 @@ a number of command line switches:
 | -Jproperty=value | | Properties to be passed to `javac` if joint compilation is enabled
| groovyc -j -Jtarget=1.6 -Jsource=1.6 A.groovy B.java
 | -Fflag | | Flags to be passed to `javac` if joint compilation is enabled | groovyc -j -Fnowarn
A.groovy B.java
 | -pa | --parameters | Generates metadata for reflection on method parameter names. Requires
Java 8+. | groovyc --parameters Person.groovy
+| -pr | --enable-preview | Enable preview Java features (JEP 12) (jdk12+ only). | groovy
--enable-preview Person.groovy
 | @argfile | | Read options and source files from specified file. | groovyc @conf/args
 |=======================================================================
 
diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
index 9ab3dd7..899536d 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
@@ -217,6 +217,11 @@ public class Groovyc extends MatchingTask {
     private boolean parameters = false;
 
     /**
+     * If true, enable preview Java features (JEP 12) (jdk12+ only). Defaults to false.
+     */
+    private boolean previewFeatures = false;
+
+    /**
      * Adds a path for source compilation.
      *
      * @return a nested src element.
@@ -826,6 +831,22 @@ public class Groovyc extends MatchingTask {
     }
 
     /**
+     * If true, enable preview Java features (JEP 12) (jdk12+ only).
+     *
+     * @param previewFeatures set to true to enable preview features
+     */
+    public void setPreviewFeatures(boolean previewFeatures) {
+        this.previewFeatures = previewFeatures;
+    }
+
+    /**
+     * Returns true if preview features has been enabled.
+     */
+    public boolean getPreviewFeatures() {
+        return previewFeatures;
+    }
+
+    /**
      * Executes the task.
      *
      * @throws BuildException if an error occurs
@@ -1102,6 +1123,9 @@ public class Groovyc extends MatchingTask {
         if (parameters) {
             commandLineList.add("--parameters");
         }
+        if (previewFeatures) {
+            commandLineList.add("--enable-preview");
+        }
         if (useIndy) {
             commandLineList.add("--indy");
         }
diff --git a/subprojects/groovy-cli-picocli/src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy
b/subprojects/groovy-cli-picocli/src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy
index 6849d3c..be164c4 100644
--- a/subprojects/groovy-cli-picocli/src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy
+++ b/subprojects/groovy-cli-picocli/src/test/groovy/groovy/cli/picocli/CliBuilderTest.groovy
@@ -896,6 +896,7 @@ class CliBuilderTest extends GroovyTestCase {
             h(longOpt: 'help', 'cli.option.help.description')
             V(longOpt: 'version', 'cli.option.version.description')
             pa(longOpt: 'parameters', 'cli.option.parameters.description')
+            pr(longOpt: 'preview', 'cli.option.preview.description')
             i(longOpt: 'indy', 'cli.option.indy.description')
             D(longOpt: 'define', args: 2, argName: 'name=value', valueSeparator: '=', 'cli.option.define.description')
             _(longOpt: 'configscript', args: 1, 'cli.option.configscript.description')
@@ -913,6 +914,14 @@ class CliBuilderTest extends GroovyTestCase {
         assert !options.pa
         assert options.arguments() == ['-parameters']
 
+        assert cli.parse(['--enable-preview']).preview
+        assert cli.parse(['--enable-preview']).pr
+
+        options = cli.parse(['-preview'])
+        assert !options.preview
+        assert !options.pr
+        assert options.arguments() == ['-preview']
+
         assert cli.parse(['--indy']).indy
         assert cli.parse(['--indy']).i
         resetPrintWriter()
@@ -951,6 +960,7 @@ class CliBuilderTest extends GroovyTestCase {
             h(longOpt: 'help', 'cli.option.help.description')
             V(longOpt: 'version', 'cli.option.version.description')
             pa(longOpt: 'parameters', 'cli.option.parameters.description')
+            pr(longOpt: 'preview', 'cli.option.preview.description')
             i(longOpt: 'indy', 'cli.option.indy.description')
             D(longOpt: 'define', args: 2, argName: 'name=value', valueSeparator: '=', 'cli.option.define.description')
             _(longOpt: 'configscript', args: 1, 'cli.option.configscript.description')
@@ -964,6 +974,10 @@ class CliBuilderTest extends GroovyTestCase {
         assert cli.parse(['-parameters']).pa
         assert cli.parse(['-pa']).parameters
 
+        assert cli.parse(['--enable-preview']).pr
+        assert cli.parse(['-preview']).pr
+        assert cli.parse(['-pr']).preview
+
         assert cli.parse(['--indy']).i
         assert cli.parse(['-indy']).i
         assert cli.parse(['-i']).indy
@@ -1012,13 +1026,15 @@ class CliBuilderTest extends GroovyTestCase {
             h(longOpt: 'help', 'cli.option.help.description')
             V(longOpt: 'version', 'cli.option.version.description')
             pa(longOpt: 'parameters', 'cli.option.parameters.description')
+            pr(longOpt: 'preview', 'cli.option.preview.description')
             i(longOpt: 'indy', 'cli.option.indy.description')
             D(longOpt: 'define', args: 2, argName: 'String', valueSeparator: '=', 'cli.option.define.description')
             _(longOpt: 'configscript', args: 1, 'cli.option.configscript.description')
         }
         cli.usage()
         def expectedUsage = """\
-Usage: groovy [-hiV] [-cp] [-pa] [-configscript=PARAM] [-D=<String>=<String>]...
+Usage: groovy [-hiV] [-cp] [-pa] [-pr] [-configscript=PARAM]
+              [-D=<String>=<String>]...
       -configscript, --configscript=PARAM
                             cli.option.configscript.description
       -cp, -classpath, --classpath
@@ -1029,6 +1045,8 @@ Usage: groovy [-hiV] [-cp] [-pa] [-configscript=PARAM] [-D=<String>=<String>]...
   -i, -indy, --indy         cli.option.indy.description
       -pa, -parameters, --parameters
                             cli.option.parameters.description
+      -pr, -preview, --enable-preview
+                            cli.option.preview.description
   -V, -version, --version   cli.option.version.description"""
         assertEquals(expectedUsage, stringWriter.toString().tokenize('\r\n').join('\n'))
 
@@ -1039,13 +1057,14 @@ Usage: groovy [-hiV] [-cp] [-pa] [-configscript=PARAM] [-D=<String>=<String>]...
             h(longOpt: 'help', 'cli.option.help.description')
             V(longOpt: 'version', 'cli.option.version.description')
             pa(longOpt: 'parameters', 'cli.option.parameters.description')
+            pr(longOpt: 'preview', 'cli.option.preview.description')
             i(longOpt: 'indy', 'cli.option.indy.description')
             D(longOpt: 'define', args: 2, argName: 'String', valueSeparator: '=', 'cli.option.define.description')
             _(longOpt: 'configscript', args: 1, 'cli.option.configscript.description')
         }
         cli.usage()
         expectedUsage = """\
-Usage: groovy [-hiV] [-cp] [-pa] [--configscript=PARAM]
+Usage: groovy [-hiV] [-cp] [-pa] [-pr] [--configscript=PARAM]
               [-D=<String>=<String>]...
       --configscript=PARAM   cli.option.configscript.description
       -cp, --classpath       cli.option.cp.description
@@ -1054,6 +1073,7 @@ Usage: groovy [-hiV] [-cp] [-pa] [--configscript=PARAM]
   -h, --help                 cli.option.help.description
   -i, --indy                 cli.option.indy.description
       -pa, --parameters      cli.option.parameters.description
+      -pr, --enable-preview         cli.option.preview.description
   -V, --version              cli.option.version.description"""
         assertEquals(expectedUsage, stringWriter.toString().tokenize('\r\n').join('\n'))
     }
diff --git a/subprojects/groovy-console/src/spec/doc/groovy-console.adoc b/subprojects/groovy-console/src/spec/doc/groovy-console.adoc
index d49639c..a77d7df 100644
--- a/subprojects/groovy-console/src/spec/doc/groovy-console.adoc
+++ b/subprojects/groovy-console/src/spec/doc/groovy-console.adoc
@@ -62,8 +62,9 @@ The Groovy Swing Console allows a user to enter and run Groovy scripts.
   -D, --define=<name=value>  Define a system property
   -h, --help                 Display this help message
   -i, --indy                 Enable InvokeDynamic (Indy) compilation for scripts
-      -pa, --parameters      Generate metadata for reflection on method parameter
+  -pa, --parameters          Generate metadata for reflection on method parameter
                                names (jdk8+ only)
+  -pr, --enable-preview             Enable preview Java features (JEP 12) (jdk12+ only)
   -V, --version              Display the version
 -----------------------------------------------------------------
 
diff --git a/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc b/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc
index b3d00f0..bb25a67 100644
--- a/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc
+++ b/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc
@@ -61,8 +61,9 @@ experiments.
                           Define a system property
   -e, --evaluate=<CODE>   Evaluate the code first when starting interactive session
   -h, --help              Display this help message
-      -pa, --parameters   Generate metadata for reflection on method parameter names
+  -pa, --parameters       Generate metadata for reflection on method parameter names
                             (jdk8+ only)
+  -pr, --enable-preview          Enable preview Java features (JEP 12) (jdk12+ only)
   -q, --quiet             Suppress superfluous output
   -T, --terminal=<TYPE>   Specify the terminal TYPE to use
   -v, --verbose           Enable verbose output


Mime
View raw message