mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
[Java] Get rid of dynamic construction of bundle keys in VMOptionsParser
IDEA-359244 GitOrigin-RevId: 94ad691d4d6066d9d910eecf59b2af612f11e62a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e729bc10c8
commit
a62930fe83
@@ -2,13 +2,13 @@ vm.option.enable.assertions.description=Enables assertions with specified granul
|
||||
vm.option.enable.system.assertions.description=Enables system assertions.
|
||||
vm.option.disable.assertions.description=Enables assertions with specified granularity.
|
||||
vm.option.disable.system.assertions.description=Disables system assertions.
|
||||
vm.option.agentpath.description=Loads native agent library by \\\<pathname\\\>.
|
||||
vm.option.agentlib.description=Loads native agent library by \\\<libname\\\>.
|
||||
vm.option.agentpath.description=Loads native agent library by \\<pathname\\>.
|
||||
vm.option.agentlib.description=Loads native agent library by \\<libname\\>.
|
||||
vm.option.javaagent.description=Loads Java programming language agent by \\\<jarpath\\\>.
|
||||
vm.option.system.property.description=Sets a system property in format <name>=<value>.
|
||||
vm.option.system.property.description=Sets a system property in format \\<name\\>=\\<value\\>.
|
||||
vm.option.advanced.option.description=Specify non-standard JVM-specific option.
|
||||
vm.option.batch.description=Disable background compilation.
|
||||
vm.option.bootclasspath/a.description=Append to end of bootstrap class path.
|
||||
vm.option.bootclasspath.a.description=Append to end of bootstrap class path.
|
||||
vm.option.check.jni.description=Perform additional checks for JNI functions.
|
||||
vm.option.comp.description=Forces compilation of methods on first invocation.
|
||||
vm.option.debug.description=Does nothing. Provided for backward compatibility.
|
||||
@@ -17,7 +17,7 @@ vm.option.future.description=Enable strictest checks, anticipating future defaul
|
||||
vm.option.int.description=Interpreted mode execution only.
|
||||
vm.option.internalversion.description=Display more detailed JVM version information than the -version option.
|
||||
vm.option.log.description=Configure or enable logging with the Java Virtual Machine (JVM) unified logging framework. Use -Xlog:help for details.
|
||||
vm.option.loggc.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>.
|
||||
vm.option.loggc.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\\>.
|
||||
vm.option.mixed.description=Mixed mode execution (default).
|
||||
vm.option.mn.description=Set the initial and maximum size (in bytes) of the heap for the young generation (nursery).
|
||||
vm.option.ms.description=Set the initial Java heap size.
|
||||
@@ -36,7 +36,7 @@ vm.option.showSettings.system.description=(Linux Only) Show host system or conta
|
||||
vm.option.ss.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.
|
||||
vm.option.verify.description=Sets the mode of the bytecode verifier Note that option -Xverify:none is deprecated and may be removed in a future release.
|
||||
vm.option.bootclasspath.description=Set the search path for bootstrap classes and resources.
|
||||
vm.option.bootclasspath/p.description=Prepend in front of the bootstrap class path.
|
||||
vm.option.bootclasspath.p.description=Prepend in front of the bootstrap class path.
|
||||
vm.option.incgc.description=Enable incremental garbage collection.
|
||||
vm.option.prof.description=Output cpu profiling data.
|
||||
vm.option.add.reads.description=Updates \\<module\\> to read \\<target-module\\>, regardless of module declaration. \\<target-module\\> can be ALL-UNNAMED to read all unnamed modules.
|
||||
@@ -46,5 +46,5 @@ vm.option.patch.module.description=Override or augment a module with classes and
|
||||
vm.option.finalization.description=Controls whether the JVM performs finalization of objects, where \\<value\\> is one of "enabled" or "disabled". Finalization is enabled by default.
|
||||
vm.option.add.exports.description=Updates \\<module\\> to export \\<package\\> to \\<target-module\\>, regardless of module declaration. \\<target-module\\> can be ALL-UNNAMED to export to all unnamed modules.
|
||||
vm.option.source.description=Set the \\<version\\> of the source in source-file mode.
|
||||
vm.option.disable.@files.description=Disable further argument file expansion.
|
||||
vm.option.disable.files.description=Disable further argument file expansion.
|
||||
vm.option.illegal.access.description=\\<value\\> permit or deny access to members of types in named modules by code in unnamed modules. \\<value\\> is one of "deny", "permit", "warn", or "debug" This option will be removed in a future release.
|
||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
import java.util.function.Supplier
|
||||
|
||||
private const val BUNDLE: String = "messages.VMOptionsBundle"
|
||||
internal const val BUNDLE: String = "messages.VMOptionsBundle"
|
||||
object VMOptionsBundle {
|
||||
private val INSTANCE = DynamicBundle(VMOptionsBundle::class.java, BUNDLE)
|
||||
|
||||
@@ -19,7 +19,4 @@ object VMOptionsBundle {
|
||||
fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): Supplier<@Nls String> {
|
||||
return INSTANCE.getLazyMessage(key = key, params = params)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isMessageInBundle(key: String): Boolean = INSTANCE.containsKey(key)
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.execution.vmOptions
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
internal object VMOptionsParser {
|
||||
private val LOG = Logger.getInstance(VMOptionsParser::class.java)
|
||||
@@ -87,16 +88,59 @@ internal object VMOptionsParser {
|
||||
|
||||
|
||||
fun build(): VMOption {
|
||||
val key = getOptionBundleKey(name)
|
||||
val description = if (VMOptionsBundle.isMessageInBundle(key)) { VMOptionsBundle.message(key) } else {
|
||||
LOG.warn("Option $name is not localized. Output of java command will be used instead. Please, localize it with the key=$key in VMOptionsBundle")
|
||||
val vmOptionMapKey = "${variant.prefix()}$name"
|
||||
val key = VM_OPTION_DESCRIPTION_PROPERTY_KEY_MAP[vmOptionMapKey]
|
||||
val description = if (key != null) {
|
||||
VMOptionsBundle.message(key)
|
||||
} else {
|
||||
LOG.warn("Option $vmOptionMapKey is not localized. Output of java command will be used instead. Please, localize it in VMOptionsBundle")
|
||||
doc.joinToString(separator = " ")
|
||||
}
|
||||
return VMOption(name, type = null, defaultValue = null, kind = VMOptionKind.Product, doc = description, variant)
|
||||
}
|
||||
|
||||
private fun getOptionBundleKey(option: String): String = "vm.option.${getCanonicalOptionName(option)}.description"
|
||||
|
||||
private fun getCanonicalOptionName(option: String): String = option.replace(Regex("[:|\\-]"), ".").trim('=', '.')
|
||||
}
|
||||
|
||||
private val VM_OPTION_DESCRIPTION_PROPERTY_KEY_MAP: Map<String, @PropertyKey(resourceBundle = BUNDLE) String> = mapOf(
|
||||
Pair("-Xbatch", "vm.option.batch.description"),
|
||||
Pair("-Xbootclasspath:", "vm.option.bootclasspath.description"),
|
||||
Pair("-Xbootclasspath/p:", "vm.option.bootclasspath.p.description"),
|
||||
Pair("-Xbootclasspath/a:", "vm.option.bootclasspath.a.description"),
|
||||
Pair("-Xdebug", "vm.option.debug.description"),
|
||||
Pair("-Xcheck:jni", "vm.option.check.jni.description"),
|
||||
Pair("-Xcomp", "vm.option.comp.description"),
|
||||
Pair("-Xdiag", "vm.option.diag.description"),
|
||||
Pair("-Xfuture", "vm.option.future.description"),
|
||||
Pair("-Xinternalversion", "vm.option.internalversion.description"),
|
||||
Pair("-Xlog:", "vm.option.log.description"),
|
||||
Pair("-Xloggc:", "vm.option.loggc.description"),
|
||||
Pair("-Xmixed", "vm.option.mixed.description"),
|
||||
Pair("-Xmn", "vm.option.mn.description"),
|
||||
Pair("-Xms", "vm.option.ms.description"),
|
||||
Pair("-Xmx", "vm.option.mx.description"),
|
||||
Pair("-Xrs", "vm.option.rs.description"),
|
||||
Pair("-Xnoclassgc", "vm.option.noclassgc.description"),
|
||||
Pair("-Xshare:auto", "vm.option.share.auto.description"),
|
||||
Pair("-Xshare:off", "vm.option.share.off.description"),
|
||||
Pair("-Xshare:on", "vm.option.share.on.description"),
|
||||
Pair("-XshowSettings", "vm.option.showSettings.description"),
|
||||
Pair("-XshowSettings:all", "vm.option.showSettings.all.description"),
|
||||
Pair("-XshowSettings:locale", "vm.option.showSettings.locale.description"),
|
||||
Pair("-XshowSettings:properties", "vm.option.showSettings.properties.description"),
|
||||
Pair("-XshowSettings:vm", "vm.option.showSettings.vm.description"),
|
||||
Pair("-XshowSettings:system", "vm.option.showSettings.system.description"),
|
||||
Pair("-Xss", "vm.option.ss.description"),
|
||||
Pair("-Xverify", "vm.option.verify.description"),
|
||||
Pair("-Xincgc", "vm.option.incgc.description"),
|
||||
Pair("-Xprof", "vm.option.prof.description"),
|
||||
Pair("-Xint", "vm.option.int.description"),
|
||||
Pair("--add-reads", "vm.option.add.reads.description"),
|
||||
Pair("--add-opens", "vm.option.add.opens.description"),
|
||||
Pair("--limit-modules", "vm.option.limit.modules.description"),
|
||||
Pair("--patch-module", "vm.option.patch.module.description"),
|
||||
Pair("--finalization=", "vm.option.finalization.description"),
|
||||
Pair("--add-exports", "vm.option.add.exports.description"),
|
||||
Pair("--source", "vm.option.source.description"),
|
||||
Pair("--disable-@files", "vm.option.disable.files.description"),
|
||||
Pair("--illegal-access=", "vm.option.illegal.access.description")
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user