Package org.codehaus.groovy.vmplugin
Class JavaFeatureVersion
java.lang.Object
org.codehaus.groovy.vmplugin.JavaFeatureVersion
The Java feature version of the running VM, e.g.
17 (GROOVY-12382).
Runtime.version() is a Java 9 API that some runtimes built on the
JDK class library do not provide (Android's ART, for one). Where it is
missing, the java.specification.version property is parsed instead,
and when that is unusable the lowest release Groovy supports is assumed.
Deliberately tiny and free of lambdas: it is consulted from static
initialisers that can run while the system class loader is being
instantiated (-Djava.system.class.loader=groovy.lang.GroovyClassLoader),
where an invokedynamic bootstrap is not yet permitted, and it must
not trigger the creation of the VM plugin.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe lowest Java release Groovy runs on. -
Method Summary
-
Field Details
-
MINIMUM
public static final int MINIMUMThe lowest Java release Groovy runs on.- See Also:
-
-
Method Details
-
current
public static int current()Returns the feature version of the running VM.- Returns:
- the feature version, never below
MINIMUM
-
parse
Parses ajava.specification.versionvalue ("1.8","17","0.9"on Android) into a feature version.- Parameters:
specificationVersion- the property value, possiblynullminimum- the value returned when the property is missing, unparseable or below it- Returns:
- the feature version
-