mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-04 11:56:55 -04:00
remove -Xincgc for Java 9
This commit is contained in:
parent
d9225b9529
commit
b81b38f7e4
@ -162,7 +162,6 @@ class VersionSettingsController {
|
|||||||
|
|
||||||
var flag = false
|
var flag = false
|
||||||
var defaultToggle: JFXRadioButton? = null
|
var defaultToggle: JFXRadioButton? = null
|
||||||
var customToggle = javaItem.radioCustom
|
|
||||||
javaItem.group.toggles.filter { it is JFXRadioButton }.forEach { toggle ->
|
javaItem.group.toggles.filter { it is JFXRadioButton }.forEach { toggle ->
|
||||||
if (toggle.userData == version.javaVersion) {
|
if (toggle.userData == version.javaVersion) {
|
||||||
toggle.isSelected = true
|
toggle.isSelected = true
|
||||||
|
@ -47,6 +47,7 @@ open class DefaultLauncher(repository: GameRepository, versionId: String, accoun
|
|||||||
|
|
||||||
protected open val defaultJVMArguments = Arguments.DEFAULT_JVM_ARGUMENTS
|
protected open val defaultJVMArguments = Arguments.DEFAULT_JVM_ARGUMENTS
|
||||||
protected open val defaultGameArguments = Arguments.DEFAULT_GAME_ARGUMENTS
|
protected open val defaultGameArguments = Arguments.DEFAULT_GAME_ARGUMENTS
|
||||||
|
protected open val forbidden = mapOf("-Xincgc" to { options.java.version >= JavaVersion.JAVA_9 })
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: the [account] must have logged in when calling this property
|
* Note: the [account] must have logged in when calling this property
|
||||||
@ -89,8 +90,6 @@ open class DefaultLauncher(repository: GameRepository, versionId: String, accoun
|
|||||||
|
|
||||||
if (options.java.version >= JavaVersion.JAVA_7)
|
if (options.java.version >= JavaVersion.JAVA_7)
|
||||||
res.add("-XX:+UseG1GC")
|
res.add("-XX:+UseG1GC")
|
||||||
else
|
|
||||||
res.add("-Xincgc")
|
|
||||||
|
|
||||||
if (options.metaspace != null && options.metaspace > 0) {
|
if (options.metaspace != null && options.metaspace > 0) {
|
||||||
if (options.java.version < JavaVersion.JAVA_8)
|
if (options.java.version < JavaVersion.JAVA_8)
|
||||||
@ -183,7 +182,7 @@ open class DefaultLauncher(repository: GameRepository, versionId: String, accoun
|
|||||||
if (options.minecraftArgs != null && options.minecraftArgs.isNotBlank())
|
if (options.minecraftArgs != null && options.minecraftArgs.isNotBlank())
|
||||||
res.addAll(options.minecraftArgs.tokenize())
|
res.addAll(options.minecraftArgs.tokenize())
|
||||||
|
|
||||||
res
|
res.filter { !(forbidden[it]?.invoke() ?: false) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +49,7 @@ data class JavaVersion internal constructor(
|
|||||||
val version = parseVersion(longVersion)
|
val version = parseVersion(longVersion)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val regex = Pattern.compile("java version \"(?<version>[1-9]*\\.[1-9]*\\.[0-9]*(.*?))\"")
|
private val regex = Pattern.compile("java version \"(?<version>(.*?))\"")
|
||||||
|
|
||||||
val UNKNOWN: Int = -1
|
val UNKNOWN: Int = -1
|
||||||
val JAVA_5: Int = 50
|
val JAVA_5: Int = 50
|
||||||
@ -173,18 +173,17 @@ data class JavaVersion internal constructor(
|
|||||||
private fun queryWindows() = LinkedList<JavaVersion>().apply {
|
private fun queryWindows() = LinkedList<JavaVersion>().apply {
|
||||||
ignoreException { this += queryRegisterKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\") }
|
ignoreException { this += queryRegisterKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\") }
|
||||||
ignoreException { this += queryRegisterKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\") }
|
ignoreException { this += queryRegisterKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\") }
|
||||||
|
ignoreException { this += queryRegisterKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\JRE\\") }
|
||||||
|
ignoreException { this += queryRegisterKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\JDK\\") }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun queryRegisterKey(location: String) = LinkedList<JavaVersion>().apply {
|
private fun queryRegisterKey(location: String) = LinkedList<JavaVersion>().apply {
|
||||||
querySubFolders(location).forEach { java ->
|
querySubFolders(location).forEach { java ->
|
||||||
val s = java.count { it == '.' }
|
|
||||||
if (s > 1) {
|
|
||||||
val home = queryRegisterValue(java, "JavaHome")
|
val home = queryRegisterValue(java, "JavaHome")
|
||||||
if (home != null)
|
if (home != null)
|
||||||
this += fromJavaHome(File(home))
|
this += fromJavaHome(File(home))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun querySubFolders(location: String) = LinkedList<String>().apply {
|
private fun querySubFolders(location: String) = LinkedList<String>().apply {
|
||||||
val cmd = arrayOf("cmd", "/c", "reg", "query", location)
|
val cmd = arrayOf("cmd", "/c", "reg", "query", location)
|
||||||
|
@ -20,7 +20,7 @@ group 'org.jackhuang'
|
|||||||
version '3.0'
|
version '3.0'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.1.4-4'
|
ext.kotlin_version = '1.1.51'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip
|
||||||
|
Loading…
x
Reference in New Issue
Block a user