remove -Xincgc for Java 9

This commit is contained in:
huangyuhui
2017-11-04 11:07:36 +08:00
parent d9225b9529
commit b81b38f7e4
5 changed files with 10 additions and 13 deletions

View File

@@ -47,6 +47,7 @@ open class DefaultLauncher(repository: GameRepository, versionId: String, accoun
protected open val defaultJVMArguments = Arguments.DEFAULT_JVM_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
@@ -89,8 +90,6 @@ open class DefaultLauncher(repository: GameRepository, versionId: String, accoun
if (options.java.version >= JavaVersion.JAVA_7)
res.add("-XX:+UseG1GC")
else
res.add("-Xincgc")
if (options.metaspace != null && options.metaspace > 0) {
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())
res.addAll(options.minecraftArgs.tokenize())
res
res.filter { !(forbidden[it]?.invoke() ?: false) }
}
/**

View File

@@ -49,7 +49,7 @@ data class JavaVersion internal constructor(
val version = parseVersion(longVersion)
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 JAVA_5: Int = 50
@@ -173,16 +173,15 @@ data class JavaVersion internal constructor(
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 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 {
querySubFolders(location).forEach { java ->
val s = java.count { it == '.' }
if (s > 1) {
val home = queryRegisterValue(java, "JavaHome")
if (home != null)
this += fromJavaHome(File(home))
}
val home = queryRegisterValue(java, "JavaHome")
if (home != null)
this += fromJavaHome(File(home))
}
}