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:11 UTC
[sling-org-apache-sling-scripting-java] 38/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 df8d76b93d76459acca5c6507091f54e20eb0b47
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Jul 2 10:04:05 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@1607305 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/scripting/java/impl/CompilerOptions.java | 10 ++++------
.../sling/scripting/java/impl/JavaScriptEngineFactory.java | 7 +++----
2 files changed, 7 insertions(+), 10 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 94019c9..0abeba3 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
@@ -26,8 +26,6 @@ public class CompilerOptions extends Options {
private String encoding;
- private static final String VERSION_AUTO = "auto";
-
/**
* Create an compiler options object using data available from
* the component configuration.
@@ -39,14 +37,14 @@ public class CompilerOptions extends Options {
opts.put(Options.KEY_GENERATE_DEBUG_INFO, classDebugInfo != null ? classDebugInfo : true);
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.DEFAULT_VM_VERSION);
- if ( VERSION_AUTO.equalsIgnoreCase((String)opts.get(Options.KEY_SOURCE_VERSION)) ) {
+ 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"));
}
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.DEFAULT_VM_VERSION);
- if ( VERSION_AUTO.equalsIgnoreCase((String)opts.get(Options.KEY_TARGET_VERSION)) ) {
+ 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"));
}
diff --git a/src/main/java/org/apache/sling/scripting/java/impl/JavaScriptEngineFactory.java b/src/main/java/org/apache/sling/scripting/java/impl/JavaScriptEngineFactory.java
index 52e7d3b..b7d4de5 100644
--- a/src/main/java/org/apache/sling/scripting/java/impl/JavaScriptEngineFactory.java
+++ b/src/main/java/org/apache/sling/scripting/java/impl/JavaScriptEngineFactory.java
@@ -65,8 +65,8 @@ import org.slf4j.LoggerFactory;
@Properties({
@Property(name="service.vendor", value="The Apache Software Foundation"),
@Property(name="service.description", value="Java Servlet Script Handler"),
- @Property(name=JavaScriptEngineFactory.PROPERTY_COMPILER_SOURCE_V_M, value=JavaScriptEngineFactory.DEFAULT_VM_VERSION),
- @Property(name=JavaScriptEngineFactory.PROPERTY_COMPILER_TARGET_V_M, value=JavaScriptEngineFactory.DEFAULT_VM_VERSION),
+ @Property(name=JavaScriptEngineFactory.PROPERTY_COMPILER_SOURCE_V_M, value=JavaScriptEngineFactory.VERSION_AUTO),
+ @Property(name=JavaScriptEngineFactory.PROPERTY_COMPILER_TARGET_V_M, value=JavaScriptEngineFactory.VERSION_AUTO),
@Property(name=JavaScriptEngineFactory.PROPERTY_CLASSDEBUGINFO, boolValue=true),
@Property(name=JavaScriptEngineFactory.PROPERTY_ENCODING, value="UTF-8")
})
@@ -84,8 +84,7 @@ public class JavaScriptEngineFactory
public static final String PROPERTY_ENCODING = "java.javaEncoding";
- /** Default source and target VM version (value is "1.6"). */
- public static final String DEFAULT_VM_VERSION = "1.6";
+ public static final String VERSION_AUTO = "auto";
@Reference
private JavaCompiler javaCompiler;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.