You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:05:14 UTC

[sling-org-apache-sling-scripting-java] 41/43: SLING-3724 : Provide option to always use current vm version for source and target

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.java-2.0.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-java.git

commit 50fa889e3a694cf28fd0f2959feb2d83051d6678
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Jul 3 07:15:46 2014 +0000

    SLING-3724 : Provide option to always use current vm version for source and target
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/java@1607547 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/scripting/java/impl/CompilerOptions.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/scripting/java/impl/CompilerOptions.java b/src/main/java/org/apache/sling/scripting/java/impl/CompilerOptions.java
index 0abeba3..38ae17e 100644
--- a/src/main/java/org/apache/sling/scripting/java/impl/CompilerOptions.java
+++ b/src/main/java/org/apache/sling/scripting/java/impl/CompilerOptions.java
@@ -31,6 +31,7 @@ public class CompilerOptions extends Options {
      * the component configuration.
      */
     public static CompilerOptions createOptions(final Dictionary<String, Object> props) {
+        final String currentVersion = System.getProperty("java.specification.version");
         final CompilerOptions opts = new CompilerOptions();
 
         final Boolean classDebugInfo = (Boolean)props.get(JavaScriptEngineFactory.PROPERTY_CLASSDEBUGINFO);
@@ -39,13 +40,13 @@ public class CompilerOptions extends Options {
         final String sourceVM = (String) props.get(JavaScriptEngineFactory.PROPERTY_COMPILER_SOURCE_V_M);
         opts.put(Options.KEY_SOURCE_VERSION, sourceVM != null && sourceVM.trim().length() > 0 ? sourceVM.trim() : JavaScriptEngineFactory.VERSION_AUTO);
         if ( JavaScriptEngineFactory.VERSION_AUTO.equalsIgnoreCase((String)opts.get(Options.KEY_SOURCE_VERSION)) ) {
-            opts.put(Options.KEY_SOURCE_VERSION, System.getProperty("java.vm.specification.version"));
+            opts.put(Options.KEY_SOURCE_VERSION, currentVersion);
         }
 
         final String targetVM = (String) props.get(JavaScriptEngineFactory.PROPERTY_COMPILER_TARGET_V_M);
         opts.put(Options.KEY_TARGET_VERSION, targetVM != null && targetVM.trim().length() > 0 ? targetVM.trim() : JavaScriptEngineFactory.VERSION_AUTO);
         if ( JavaScriptEngineFactory.VERSION_AUTO.equalsIgnoreCase((String)opts.get(Options.KEY_TARGET_VERSION)) ) {
-            opts.put(Options.KEY_TARGET_VERSION, System.getProperty("java.vm.specification.version"));
+            opts.put(Options.KEY_TARGET_VERSION, currentVersion);
         }
 
         final String encoding = (String) props.get(JavaScriptEngineFactory.PROPERTY_ENCODING);

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.