Java 类org.gradle.api.JavaVersion 实例源码

项目:Reer    文件:JavaInstallationProbe.java   
public ProbeResult checkJdk(File jdkPath) {
    if (!jdkPath.exists()) {
        return ProbeResult.failure(InstallType.NO_SUCH_DIRECTORY, "No such directory: " + jdkPath);
    }
    EnumMap<SysProp, String> metadata = cache.getUnchecked(jdkPath);
    String version = metadata.get(SysProp.VERSION);
    if (UNKNOWN.equals(version)) {
        return ProbeResult.failure(InstallType.INVALID_JDK, metadata.get(SysProp.Z_ERROR));
    }
    try {
        JavaVersion.toVersion(version);
    } catch (IllegalArgumentException ex) {
        // if the version string cannot be parsed
        return ProbeResult.failure(InstallType.INVALID_JDK, "Cannot parse version number: " + version);
    }
    if (javaExe(jdkPath, "javac").exists()) {
        return ProbeResult.success(InstallType.IS_JDK, metadata);
    }
    return ProbeResult.success(InstallType.IS_JRE, metadata);
}
项目:Reer    文件:FindBugs.java   
@TaskAction
public void run() throws IOException, InterruptedException {
    new FindBugsClasspathValidator(JavaVersion.current()).validateClasspath(
        Iterables.transform(getFindbugsClasspath().getFiles(), new Function<File, String>() {
            @Override
            public String apply(File input) {
                return input.getName();
            }
        }));
    FindBugsSpec spec = generateSpec();
    FindBugsWorkerManager manager = new FindBugsWorkerManager();

    getLogging().captureStandardOutput(LogLevel.DEBUG);
    getLogging().captureStandardError(LogLevel.DEBUG);

    FindBugsResult result = manager.runWorker(getProject().getProjectDir(), getWorkerProcessBuilderFactory(), getFindbugsClasspath(), spec);
    evaluateResult(result);
}
项目:Reer    文件:WindowsOracleJvmLocator.java   
private void findJvms(WindowsRegistry windowsRegistry, String sdkSubkey, Collection<JvmInstallation> jvms, boolean jdk, JvmInstallation.Arch arch) {
    List<String> versions;
    try {
        versions = windowsRegistry.getSubkeys(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, sdkSubkey);
    } catch (MissingRegistryEntryException e) {
        // Ignore
        return;
    }

    for (String version : versions) {
        if (version.matches("\\d+\\.\\d+")) {
            continue;
        }
        String javaHome = windowsRegistry.getStringValue(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, sdkSubkey + '\\' + version, "JavaHome");
        jvms.add(new JvmInstallation(JavaVersion.toVersion(version), version, new File(javaHome), jdk, arch));
    }
}
项目:Reer    文件:UbuntuJvmLocator.java   
public Collection<JvmInstallation> findJvms() {
    List<JvmInstallation> jvms = new ArrayList<JvmInstallation>();
    if (libDir.isDirectory()) {
        for (File javaHome : libDir.listFiles()) {
            Matcher matcher = JAVA_HOME_DIR_PATTERN.matcher(javaHome.getName());
            if (!matcher.matches()) {
                continue;
            }
            if (!new File(javaHome, "jre/bin/java").isFile()) {
                continue;
            }
            String version = matcher.group(1);
            String arch = matcher.group(2);
            boolean jdk = new File(javaHome, "bin/javac").isFile();
            jvms.add(new JvmInstallation(JavaVersion.toVersion(version), version, fileCanonicalizer.canonicalize(javaHome), jdk, toArch(arch)));
        }
    }
    return jvms;
}
项目:Reer    文件:AvailableJavaHomes.java   
public List<JvmInstallation> findJvms() {
    List<JvmInstallation> jvms = new ArrayList<JvmInstallation>();
    if (OperatingSystem.current().isLinux()) {
        jvms = addJvm(jvms, JavaVersion.VERSION_1_5, "1.5.0", new File("/opt/jdk/sun-jdk-5"), true, JvmInstallation.Arch.i386);
        jvms = addJvm(jvms, JavaVersion.VERSION_1_6, "1.6.0", new File("/opt/jdk/sun-jdk-6"), true, JvmInstallation.Arch.x86_64);
        jvms = addJvm(jvms, JavaVersion.VERSION_1_6, "1.6.0", new File("/opt/jdk/ibm-jdk-6"), true, JvmInstallation.Arch.x86_64);
        jvms = addJvm(jvms, JavaVersion.VERSION_1_7, "1.7.0", new File("/opt/jdk/oracle-jdk-7"), true, JvmInstallation.Arch.x86_64);
        jvms = addJvm(jvms, JavaVersion.VERSION_1_8, "1.8.0", new File("/opt/jdk/oracle-jdk-8"), true, JvmInstallation.Arch.x86_64);
        jvms = addJvm(jvms, JavaVersion.VERSION_1_9, "1.9.0", new File("/opt/jdk/oracle-jdk-9"), true, JvmInstallation.Arch.x86_64);
    }
    return CollectionUtils.filter(jvms, new Spec<JvmInstallation>() {
        public boolean isSatisfiedBy(JvmInstallation element) {
            return element.getJavaHome().isDirectory();
        }
    });
}
项目:Reer    文件:AvailableJavaHomes.java   
public List<JvmInstallation> findJvms() {
    Set<File> javaHomes = new HashSet<File>();
    List<JvmInstallation> jvms = new ArrayList<JvmInstallation>();
    for (File file : baseDir.listFiles()) {
        Matcher matcher = JDK_DIR.matcher(file.getName());
        if (!matcher.matches()) {
            continue;
        }
        File javaHome = fileCanonicalizer.canonicalize(file);
        if (!javaHomes.add(javaHome)) {
            continue;
        }
        if (!new File(file, "bin/javac").isFile()) {
            continue;
        }
        String version = matcher.group(1);
        jvms.add(new JvmInstallation(JavaVersion.toVersion(version), version, file, true, JvmInstallation.Arch.Unknown));
    }
    return jvms;
}
项目:Reer    文件:DefaultGradleDistribution.java   
private boolean worksWith(JavaVersion javaVersion) {
    // 0.9-rc-1 was broken for Java 5
    if (isVersion("0.9-rc-1") && javaVersion == JavaVersion.VERSION_1_5) {
        return false;
    }

    // 1.x works on Java 5 - 8
    if (isSameOrOlder("1.12")) {
        return javaVersion.compareTo(JavaVersion.VERSION_1_5) >= 0 && javaVersion.compareTo(JavaVersion.VERSION_1_8) <= 0;
    }

    // 2.x and 3.0-milestone-1 work on Java 6 - 8
    if (isSameOrOlder("3.0-milestone-1")) {
        return javaVersion.compareTo(JavaVersion.VERSION_1_6) >= 0 && javaVersion.compareTo(JavaVersion.VERSION_1_8) <= 0;
    }

    // 3.x works on Java 7 - 9
    return javaVersion.compareTo(JavaVersion.VERSION_1_7) >= 0 && javaVersion.compareTo(JavaVersion.VERSION_1_9) <= 0;
}
项目:Reer    文件:DaemonGradleExecuter.java   
@Override
protected List<String> getImplicitBuildJvmArgs() {
    if (!isUseDaemon() || !isSharedDaemons()) {
        return super.getImplicitBuildJvmArgs();
    }

    // Add JVM heap settings only for shared daemons
    List<String> buildJvmOpts = new ArrayList<String>(super.getImplicitBuildJvmArgs());

    if (JVM_VERSION_DETECTOR.getJavaVersion(Jvm.forHome(getJavaHome())).compareTo(JavaVersion.VERSION_1_8) < 0) {
        buildJvmOpts.add("-XX:MaxPermSize=320m");
    }

    buildJvmOpts.add("-XX:+HeapDumpOnOutOfMemoryError");
    buildJvmOpts.add("-XX:HeapDumpPath=" + buildContext.getGradleUserHomeDir().getAbsolutePath());
    return buildJvmOpts;
}
项目:Reer    文件:DefaultJvmVersionDetector.java   
private JavaVersion parseJavaVersionCommandOutput(String javaExecutable, BufferedReader reader) {
    try {
        String versionStr = reader.readLine();
        while (versionStr != null) {
            Matcher matcher = Pattern.compile("(?:java|openjdk) version \"(.+?)\"").matcher(versionStr);
            if (matcher.matches()) {
                return JavaVersion.toVersion(matcher.group(1));
            }
            versionStr = reader.readLine();
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }

    throw new GradleException(String.format("Could not determine Java version using executable %s.", javaExecutable));
}
项目:Reer    文件:JdkTools.java   
JdkTools(JavaInfo javaInfo) {
    DefaultClassLoaderFactory defaultClassLoaderFactory = new DefaultClassLoaderFactory();
    JavaVersion javaVersion = Jvm.current().getJavaVersion();
    boolean java9Compatible = javaVersion.isJava9Compatible();
    ClassLoader filteringClassLoader = getSystemFilteringClassLoader(defaultClassLoaderFactory, java9Compatible);
    if (!java9Compatible) {
        File toolsJar = javaInfo.getToolsJar();
        if (toolsJar == null) {
            throw new IllegalStateException("Could not find tools.jar. Please check that "
                                            + javaInfo.getJavaHome().getAbsolutePath()
                                            + " contains a valid JDK installation.");
        }
        DefaultClassPath defaultClassPath = new DefaultClassPath(toolsJar);
        isolatedToolsLoader = new VisitableURLClassLoader(filteringClassLoader, defaultClassPath.getAsURLs());
        isJava9Compatible = false;
    } else {
        isolatedToolsLoader = filteringClassLoader;
        isJava9Compatible = true;
    }
}
项目:Reer    文件:Jdt.java   
@Override
protected void store(Properties properties) {
    properties.put("org.eclipse.jdt.core.compiler.compliance", sourceCompatibility.toString());
    properties.put("org.eclipse.jdt.core.compiler.source", sourceCompatibility.toString());

    if (sourceCompatibility.compareTo(JavaVersion.VERSION_1_3) <= 0) {
        properties.put("org.eclipse.jdt.core.compiler.problem.assertIdentifier", "ignore");
        properties.put("org.eclipse.jdt.core.compiler.problem.enumIdentifier", "ignore");
    } else if (sourceCompatibility == JavaVersion.VERSION_1_4) {
        properties.put("org.eclipse.jdt.core.compiler.problem.assertIdentifier", "error");
        properties.put("org.eclipse.jdt.core.compiler.problem.enumIdentifier", "warning");
    } else {
        properties.put("org.eclipse.jdt.core.compiler.problem.assertIdentifier", "error");
        properties.put("org.eclipse.jdt.core.compiler.problem.enumIdentifier", "error");
    }

    properties.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", targetCompatibility.toString());
}
项目:Reer    文件:Project.java   
public void configure(List<IdeaModule> modules,
                      String jdkName, IdeaLanguageLevel languageLevel, JavaVersion bytecodeVersion,
                      Collection<String> wildcards, Collection<ProjectLibrary> projectLibraries, String vcs) {
    if (!isNullOrEmpty(jdkName)) {
        jdk = new Jdk(jdkName, languageLevel);
    }
    this.bytecodeVersion = bytecodeVersion;
    this.modulePaths.addAll(Lists.transform(modules, new Function<IdeaModule, Path>() {
        @Override
        public Path apply(IdeaModule module) {
            return pathFactory.relativePath("PROJECT_DIR", module.getOutputFile());
        }
    }));
    this.wildcards.addAll(wildcards);
    this.modules = modules;
    // overwrite rather than append libraries
    this.projectLibraries = Sets.newLinkedHashSet(projectLibraries);
    this.vcs = vcs;
}
项目:Reer    文件:Project.java   
private void storeBytecodeLevels() {
    Node bytecodeLevelConfiguration = findOrCreateBytecodeLevelConfiguration();
    bytecodeLevelConfiguration.attributes().put("target", bytecodeVersion.toString());
    for (IdeaModule module : modules) {
        List<Node> bytecodeLevelModules = getChildren(bytecodeLevelConfiguration, "module");
        Node moduleNode = findFirstWithAttributeValue(bytecodeLevelModules, "name", module.getName());
        JavaVersion moduleBytecodeVersionOverwrite = module.getTargetBytecodeVersion();
        if (moduleBytecodeVersionOverwrite == null) {
            if (moduleNode != null) {
                bytecodeLevelConfiguration.remove(moduleNode);
            }
        } else {
            if (moduleNode == null) {
                moduleNode = bytecodeLevelConfiguration.appendNode("module");
                moduleNode.attributes().put("name", module.getName());
            }
            moduleNode.attributes().put("target", moduleBytecodeVersionOverwrite.toString());
        }
    }
}
项目:Reer    文件:PmdPlugin.java   
public TargetJdk getDefaultTargetJdk(JavaVersion javaVersion) {
    try {
        return TargetJdk.toVersion(javaVersion.toString());
    } catch (IllegalArgumentException ignored) {
        // TargetJDK does not include 1.1, 1.2 and 1.8;
        // Use same fallback as PMD
        return TargetJdk.VERSION_1_4;
    }
}
项目:Reer    文件:FindBugsClasspathValidator.java   
public void validateClasspath(Iterable<String> fileNamesOnClasspath) {
    VersionNumber v = getFindbugsVersion(fileNamesOnClasspath);
    boolean java8orMore = javaVersion.compareTo(JavaVersion.VERSION_1_7) > 0;
    boolean findbugs2orLess = v.getMajor() < 3;
    if (java8orMore && findbugs2orLess) {
        throw new FindBugsVersionTooLowException("The version of FindBugs (" + v + ") inferred from FindBugs classpath is too low to work with currently used Java version (" + javaVersion + ")."
                + " Please use higher version of FindBugs. Inspected FindBugs classpath: " + fileNamesOnClasspath);
    }
}
项目:Reer    文件:Jvm.java   
private Jvm(OperatingSystem os, File suppliedJavaBase, JavaVersion javaVersion, boolean userSupplied) {
    this.os = os;
    this.javaBase = suppliedJavaBase;
    this.javaHome = findJavaHome(suppliedJavaBase);
    this.javaVersion = javaVersion;
    this.userSupplied = userSupplied;
}
项目:Reer    文件:Jvm.java   
/**
 * Locates the JRE installation for this JVM. Returns null if no JRE installation is available.
 */
@Nullable
public Jre getJre() {
    File jreDir = new File(javaBase, "jre");
    if (jreDir.isDirectory()) {
        return new DefaultJre(jreDir);
    } else if (JavaVersion.current().isJava9Compatible()) {
        return null;
    }
    return new DefaultJre(javaBase);
}
项目:Reer    文件:UnsupportedJavaRuntimeException.java   
public static void assertUsingVersion(String component, JavaVersion minVersion) throws UnsupportedJavaRuntimeException {
    JavaVersion current = JavaVersion.current();
    if (current.compareTo(minVersion) >= 0) {
        return;
    }
    throw new UnsupportedJavaRuntimeException(String.format("%s %s requires Java %s or later to run. You are currently using Java %s.", component, GradleVersion.current().getVersion(),
        minVersion.getMajorVersion(), current.getMajorVersion()));
}
项目:Reer    文件:UnsupportedJavaRuntimeException.java   
public static void assertUsingVersion(String component, JavaVersion minVersion, JavaVersion configuredVersion) throws UnsupportedJavaRuntimeException {
    if (configuredVersion.compareTo(minVersion) >= 0) {
        return;
    }
    throw new UnsupportedJavaRuntimeException(String.format("%s %s requires Java %s or later to run. Your build is currently configured to use Java %s.", component, GradleVersion.current().getVersion(),
            minVersion.getMajorVersion(), configuredVersion.getMajorVersion()));
}
项目:Reer    文件:JvmInstallation.java   
public JvmInstallation(JavaVersion javaVersion, String version, File javaHome, boolean jdk, Arch arch) {
    this.javaVersion = javaVersion;
    this.version = VersionNumber.withPatchNumber().parse(version);
    this.javaHome = javaHome;
    this.jdk = jdk;
    this.arch = arch;
}
项目:Reer    文件:WatchServiceRegistrar.java   
private static WatchEvent.Modifier[] instantiateWatchModifiers() {
    if (JavaVersion.current().isJava9Compatible()) {
        return new WatchEvent.Modifier[]{};
    } else {
        // use reflection to support older JVMs while supporting Java 9
        WatchEvent.Modifier highSensitive = instantiateEnum("com.sun.nio.file.SensitivityWatchEventModifier", "HIGH");
        if (FILE_TREE_WATCHING_SUPPORTED) {
            WatchEvent.Modifier fileTree = instantiateEnum("com.sun.nio.file.ExtendedWatchEventModifier", "FILE_TREE");
            return new WatchEvent.Modifier[]{fileTree, highSensitive};
        } else {
            return new WatchEvent.Modifier[]{highSensitive};
        }
    }
}
项目:Reer    文件:AvailableJavaHomes.java   
/**
 * Returns a JDK for each of the given java versions, if available.
 */
public static List<Jvm> getJdks(final String... versions) {
    List<JavaVersion> javaVersions = Lists.transform(Arrays.asList(versions), new Function<String, JavaVersion>() {
        @Override
        public JavaVersion apply(@javax.annotation.Nullable String version) {
            return JavaVersion.toVersion(version);
        }
    });
    return getJdks(Iterables.toArray(javaVersions, JavaVersion.class));
}
项目:Reer    文件:AvailableJavaHomes.java   
/**
 * Returns a JDK for each of the given java versions, if available.
 */
public static List<Jvm> getJdks(JavaVersion... versions) {
    final Set<JavaVersion> remaining = Sets.newHashSet(versions);
    return getAvailableJdks(new Spec<JvmInstallation>() {
        @Override
        public boolean isSatisfiedBy(JvmInstallation element) {
            return remaining.remove(element.getJavaVersion());
        }
    });
}
项目:Reer    文件:AvailableJavaHomes.java   
/**
 * Returns all JDKs for the given java version.
 */
public static List<Jvm> getAvailableJdks(final JavaVersion version) {
    return getAvailableJdks(new Spec<JvmInstallation>() {
        @Override
        public boolean isSatisfiedBy(JvmInstallation element) {
            return version.equals(element.getJavaVersion());
        }
    });
}
项目:Reer    文件:AvailableJavaHomes.java   
public static Map<Jvm, JavaVersion> getAvailableJdksWithVersion() {
    Map<Jvm, JavaVersion> result = new HashMap<Jvm, JavaVersion>();
    for (JavaVersion javaVersion : JavaVersion.values()) {
        for (Jvm javaInfo : getAvailableJdks(javaVersion)) {
            result.put(javaInfo, javaVersion);
        }
    }
    return result;
}
项目:Reer    文件:JvmVersionValidator.java   
public void validate(DaemonParameters parameters) {
    if (parameters.getEffectiveJvm().equals(Jvm.current())) {
        return;
    }

    JavaVersion javaVersion = versionDetector.getJavaVersion(parameters.getEffectiveJvm());
    UnsupportedJavaRuntimeException.assertUsingVersion("Gradle", JavaVersion.VERSION_1_7, javaVersion);
}
项目:Reer    文件:DaemonParameters.java   
public void applyDefaultsFor(JavaVersion javaVersion) {
    if (hasJvmArgs) {
        return;
    }
    if (javaVersion.compareTo(JavaVersion.VERSION_1_9) >= 0) {
        jvmOptions.jvmArgs(DEFAULT_JVM_9_ARGS);
    } else {
        jvmOptions.jvmArgs(DEFAULT_JVM_ARGS);
    }
}
项目:Reer    文件:DefaultConnection.java   
private ProviderOperationParameters validateAndConvert(BuildParameters buildParameters) {
    LOGGER.info("Tooling API is using target Gradle version: {}.", GradleVersion.current().getVersion());
    UnsupportedJavaRuntimeException.assertUsingVersion("Gradle", JavaVersion.VERSION_1_7);
    if (!supportedConsumerVersion) {
        throw unsupportedConnectionException();
    }
    return adapter.builder(ProviderOperationParameters.class).mixInTo(ProviderOperationParameters.class, BuildLogLevelMixIn.class).build(buildParameters);
}
项目:Reer    文件:CachingJvmVersionDetector.java   
@Override
public JavaVersion getJavaVersion(JavaInfo jvm) {
    JavaVersion version = javaHomeResults.get(jvm);
    if (version != null) {
        return version;
    }

    version = delegate.getJavaVersion(jvm);
    javaHomeResults.put(jvm, version);

    return version;
}
项目:Reer    文件:CachingJvmVersionDetector.java   
@Override
public JavaVersion getJavaVersion(String javaCommand) {
    JavaVersion version = javaCmdResults.get(javaCommand);
    if (version != null) {
        return version;
    }

    version = delegate.getJavaVersion(javaCommand);
    javaCmdResults.put(javaCommand, version);
    return version;
}
项目:Reer    文件:DefaultJvmVersionDetector.java   
@Override
public JavaVersion getJavaVersion(String javaCommand) {
    StreamByteBuffer buffer = new StreamByteBuffer();

    ExecHandleBuilder builder = execHandleFactory.newExec();
    builder.setWorkingDir(new File(".").getAbsolutePath());
    builder.setCommandLine(javaCommand, "-version");
    builder.setStandardOutput(NullOutputStream.INSTANCE);
    builder.setErrorOutput(buffer.getOutputStream());
    builder.build().start().waitForFinish().assertNormalExitValue();

    return parseJavaVersionCommandOutput(javaCommand, new BufferedReader(new InputStreamReader(buffer.getInputStream())));
}
项目:Reer    文件:Java9ClassReader.java   
private static byte[] fixupClassVersion(byte[] classData) {
    byte[] tmp = classData;
    if (JavaVersion.forClass(classData) == JavaVersion.VERSION_1_9) {
        tmp = new byte[classData.length];
        System.arraycopy(classData, 0, tmp, 0, classData.length);
        // TODO: CC, until ASM6 is out, let's pretend we're parsing a Java 8 class format
        tmp[7] = 52;
    }
    return tmp;
}
项目:Reer    文件:DownloadingScalaToolChain.java   
public DownloadingScalaToolChain(File gradleUserHomeDir, File rootProjectDir, WorkerDaemonManager compilerDaemonManager, ConfigurationContainer configurationContainer, DependencyHandler dependencyHandler) {
    this.gradleUserHomeDir = gradleUserHomeDir;
    this.rootProjectDir = rootProjectDir;
    this.compilerDaemonManager = compilerDaemonManager;
    this.configurationContainer = configurationContainer;
    this.dependencyHandler = dependencyHandler;
    this.javaVersion = JavaVersion.current();
}
项目:Reer    文件:EclipseWtpPlugin.java   
private String toJavaFacetVersion(JavaVersion version) {
    if (version.equals(JavaVersion.VERSION_1_5)) {
        return "5.0";
    }

    if (version.equals(JavaVersion.VERSION_1_6)) {
        return "6.0";
    }

    return version.toString();
}
项目:Reer    文件:IdeaModelBuilder.java   
private void appendModule(Map<String, DefaultIdeaModule> modules, IdeaModule ideaModule, DefaultIdeaProject ideaProject, DefaultGradleProject rootGradleProject) {
    DefaultIdeaContentRoot contentRoot = new DefaultIdeaContentRoot()
        .setRootDirectory(ideaModule.getContentRoot())
        .setSourceDirectories(srcDirs(ideaModule.getSourceDirs(), ideaModule.getGeneratedSourceDirs()))
        .setTestDirectories(srcDirs(ideaModule.getTestSourceDirs(), ideaModule.getGeneratedSourceDirs()))
        .setExcludeDirectories(ideaModule.getExcludeDirs());

    Project project = ideaModule.getProject();

    DefaultIdeaModule defaultIdeaModule = new DefaultIdeaModule()
        .setName(ideaModule.getName())
        .setParent(ideaProject)
        .setGradleProject(rootGradleProject.findByPath(ideaModule.getProject().getPath()))
        .setContentRoots(Collections.singletonList(contentRoot))
        .setCompilerOutput(new DefaultIdeaCompilerOutput()
            .setInheritOutputDirs(ideaModule.getInheritOutputDirs() != null ? ideaModule.getInheritOutputDirs() : false)
            .setOutputDir(ideaModule.getOutputDir())
            .setTestOutputDir(ideaModule.getTestOutputDir()));
    JavaPluginConvention javaPluginConvention = project.getConvention().findPlugin(JavaPluginConvention.class);
    if (javaPluginConvention != null) {
        final IdeaLanguageLevel ideaModuleLanguageLevel = ideaModule.getLanguageLevel();
        JavaVersion moduleSourceLanguageLevel = convertIdeaLanguageLevelToJavaVersion(ideaModuleLanguageLevel);
        JavaVersion moduleTargetBytecodeVersion = ideaModule.getTargetBytecodeVersion();
        defaultIdeaModule.setJavaLanguageSettings(new DefaultIdeaJavaLanguageSettings()
            .setSourceLanguageLevel(moduleSourceLanguageLevel)
            .setTargetBytecodeVersion(moduleTargetBytecodeVersion));
    }

    modules.put(ideaModule.getName(), defaultIdeaModule);
}
项目:Reer    文件:IdeaModelBuilder.java   
private JavaVersion convertIdeaLanguageLevelToJavaVersion(IdeaLanguageLevel ideaLanguageLevel) {
    if (ideaLanguageLevel == null) {
        return null;
    }
    String languageLevel = ideaLanguageLevel.getLevel();
    return JavaVersion.valueOf(languageLevel.replaceFirst("JDK", "VERSION"));
}
项目:Reer    文件:IdeaLanguageLevel.java   
public IdeaLanguageLevel(Object version) {
    if (version != null && version instanceof String && ((String) version).startsWith("JDK_")) {
        level = (String) version;
        return;
    }
    level = JavaVersion.toVersion(version).name().replaceFirst("VERSION", "JDK");
}
项目:Reer    文件:S3Client.java   
private void checkRequiredJigsawModuleIsOnPath() {
    if (JavaVersion.current().isJava9Compatible()) {
        try {
            Class.forName("javax.xml.bind.DatatypeConverter");
        } catch (ClassNotFoundException e) {
            throw new GradleException("Cannot publish to S3 since the module 'java.xml.bind' is not available. "
                + "Please add \"-addmods java.xml.bind '-Dorg.gradle.jvmargs=-addmods java.xml.bind'\" to your GRADLE_OPTS.");
        }
    }
}
项目:Reer    文件:JavaPlatform.java   
@Internal
JavaVersion getTargetCompatibility();
项目:Reer    文件:DefaultJavaPlatform.java   
public DefaultJavaPlatform(JavaVersion javaVersion) {
    this.name = generateName(javaVersion);
    this.targetCompatibility = javaVersion;
}