Class LanguageVersion


  • public abstract class LanguageVersion
    extends java.lang.Object
    The language version being compiled, corresponding to javac's -source, -target, and --release flags.
    • Constructor Detail

      • LanguageVersion

        public LanguageVersion()
    • Method Detail

      • source

        public abstract int source()
        The source version.
      • target

        public abstract int target()
        The target version.
      • release

        public abstract java.util.OptionalInt release()
        The release version.

        If set, system APIs will be resolved from the host JDK's ct.sym instead of using the provided --bootclasspath.

      • majorVersion

        public int majorVersion()
        The class file major version corresponding to the target().
      • sourceVersion

        public javax.lang.model.SourceVersion sourceVersion()
      • createDefault

        public static LanguageVersion createDefault()
        The default language version. Currently Java 8.
      • fromJavacopts

        public static LanguageVersion fromJavacopts​(com.google.common.collect.ImmutableList<java.lang.String> javacopts)
        Returns the effective LanguageVersion for the given list of javac options.