[Java] Add X options from JAVA 8

IDEA-359244

GitOrigin-RevId: 75650035b837827da1fb8b0ce02922259fe668fe
This commit is contained in:
Georgii Ustinov
2024-09-20 14:45:54 +03:00
committed by intellij-monorepo-bot
parent ef0cbfa9c8
commit bf7a6011d5
2 changed files with 19 additions and 7 deletions

View File

@@ -13,14 +13,14 @@ java.command.terminal.dry.run.option.description=Create VM and load the main cla
java.command.terminal.argument.main.class.text=mainclass
java.command.terminal.default.argument.text=value
java.command.terminal.batch.option.description=Disable background compilation.
java.command.terminal.bootclasspath/a.option.description=<directories and zip/jar files separated by :> append to end of bootstrap class path.
java.command.terminal.bootclasspath/a.option.description=Append to end of bootstrap class path.
java.command.terminal.check.jni.option.description=Perform additional checks for JNI functions.
java.command.terminal.comp.option.description=Forces compilation of methods on first invocation.
java.command.terminal.debug.option.description=Does nothing. Provided for backward compatibility.
java.command.terminal.diag.option.description=Show additional diagnostic messages.
java.command.terminal.future.option.description=Enable strictest checks, anticipating future default. This option is deprecated and may be removed in a future release.
java.command.terminal.int.option.description=Interpreted mode execution only
java.command.terminal.internalversion.option.description=Display more detailed JVM version information than the -version option
java.command.terminal.int.option.description=Interpreted mode execution only.
java.command.terminal.internalversion.option.description=Display more detailed JVM version information than the -version option.
java.command.terminal.log.option.description=Configure or enable logging with the Java Virtual Machine (JVM) unified logging framework. Use -Xlog:help for details.
java.command.terminal.loggc.option.description=Log GC status to a file with time stamps. This option is deprecated and may be removed in a future release. It is replaced by -Xlog:gc:<file>.
java.command.terminal.mixed.option.description=Mixed mode execution (default).
@@ -39,4 +39,8 @@ java.command.terminal.showSettings.properties.option.description=Show all proper
java.command.terminal.showSettings.vm.option.description=Show all vm related settings and continue.
java.command.terminal.showSettings.system.option.description=(Linux Only) Show host system or container configuration and continue.
java.command.terminal.ss.option.description=Set java thread stack size The actual size may be rounded up to a multiple of the system page size as required by the operating system.
java.command.terminal.verify.option.description=Sets the mode of the bytecode verifier Note that option -Xverify:none is deprecated and may be removed in a future release.
java.command.terminal.verify.option.description=Sets the mode of the bytecode verifier Note that option -Xverify:none is deprecated and may be removed in a future release.
java.command.terminal.bootclasspath.option.description=Set the search path for bootstrap classes and resources.
java.command.terminal.bootclasspath/p.option.description=Prepend in front of the bootstrap class path.
java.command.terminal.incgc.option.description=Enable incremental garbage collection.
java.command.terminal.prof.option.description=Output cpu profiling data.

View File

@@ -5,6 +5,7 @@ import com.intellij.execution.vmOptions.VMOption
import com.intellij.execution.vmOptions.VMOptionKind
import com.intellij.execution.vmOptions.VMOptionVariant
import com.intellij.execution.vmOptions.VMOptionsService
import com.intellij.openapi.diagnostic.Logger
import com.intellij.terminal.completion.spec.ShellCommandSpec
import com.intellij.terminal.completion.spec.ShellRuntimeContext
import kotlinx.coroutines.Dispatchers
@@ -27,7 +28,7 @@ class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
VMOptionsService.getInstance().getOrComputeOptionsForJdk(path).get() ?: return@withContext null
} ?: return@dynamicOptions
val optionByVariant = jdkOptionsData.options.filter { it.kind == VMOptionKind.Standard || it.kind == VMOptionKind.Product }.groupBy { it.variant }
addOptionsFromVM(optionByVariant[VMOptionVariant.X])
addXOptionsFromVM(optionByVariant[VMOptionVariant.X])
}
description(JavaTerminalBundle.message("java.command.terminal.description"))
option("--help", "-help", "-h") {
@@ -68,7 +69,7 @@ class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
}
}
private fun ShellChildOptionsContext.addOptionsFromVM(optionList: List<VMOption>?) {
private fun ShellChildOptionsContext.addXOptionsFromVM(optionList: List<VMOption>?) {
if (optionList == null) return
optionList.forEach {
val presentableName = "${it.variant.prefix()}${it.optionName}"
@@ -77,6 +78,9 @@ class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
if (JavaTerminalBundle.isMessageInBundle(it.optionName.getXOptionBundleKey())) {
description(JavaTerminalBundle.message(it.optionName.getXOptionBundleKey()))
} else {
LOG.warn("Unknown X option: \"${it.optionName}\". Paste following string into the JavaTerminalBundle.properties:\n" +
"${it.optionName.getXOptionBundleKey()}=${it.doc}")
}
if (!KNOWN_X_OPTIONS_WITH_ARGUMENT.contains(presentableName)) return@option
@@ -93,7 +97,9 @@ class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
"-Xmx",
"-Xmn",
"-Xss",
"-Xbootclasspath:",
"-Xbootclasspath/a:",
"-Xbootclasspath/p:",
"-Xlog:",
"-Xloggc:",
)
@@ -108,4 +114,6 @@ class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
val name = this.replace(':', '.').trim('.')
return "java.command.terminal.$name.option.description"
}
}
}
private val LOG = Logger.getInstance(JavaShellCommandSpecsProvider::class.java)