MCPcopy Create free account
hub / github.com/MultiMC/Launcher / checkJVMArgs

Method checkJVMArgs

launcher/JavaCommon.cpp:5–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <MMCStrings.h>
4
5bool JavaCommon::checkJVMArgs(QString jvmargs, QWidget *parent)
6{
7 if (jvmargs.contains("-XX:PermSize=") || jvmargs.contains(QRegExp("-Xm[sx]"))
8 || jvmargs.contains("-XX-MaxHeapSize") || jvmargs.contains("-XX:InitialHeapSize"))
9 {
10 auto warnStr = QObject::tr(
11 "You tried to manually set a JVM memory option (using \"-XX:PermSize\", \"-XX-MaxHeapSize\", \"-XX:InitialHeapSize\", \"-Xmx\" or \"-Xms\").\n"
12 "There are dedicated boxes for these in the settings (Java tab, in the Memory group at the top).\n"
13 "This message will be displayed until you remove them from the JVM arguments.");
14 CustomMessageBox::selectable(
15 parent, QObject::tr("JVM arguments warning"),
16 warnStr,
17 QMessageBox::Warning)->exec();
18 return false;
19 }
20 // block lunacy with passing required version to the JVM
21 if (jvmargs.contains(QRegExp("-version:.*"))) {
22 auto warnStr = QObject::tr(
23 "You tried to pass required java version argument to the JVM (using \"-version=xxx\"). This is not safe and will not be allowed.\n"
24 "This message will be displayed until you remove this from the JVM arguments.");
25 CustomMessageBox::selectable(
26 parent, QObject::tr("JVM arguments warning"),
27 warnStr,
28 QMessageBox::Warning)->exec();
29 return false;
30 }
31 return true;
32}
33
34void JavaCommon::javaWasOk(QWidget *parent, JavaCheckResult result)
35{

Callers

nothing calls this directly

Calls 3

selectableFunction · 0.85
containsMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected