[java] renames AppMain class to avoid clashes with an older version on the class path

IDEA 2017.1 may run AppMain as a Java agent. This fails with 'NSME: premain' when idea_rt.jar from an older version is on a class path.
This commit is contained in:
Roman Shevchenko
2017-01-31 17:54:40 +01:00
parent 9ddeeedd64
commit 0c840ce22b
3 changed files with 7 additions and 7 deletions

View File

@@ -25,7 +25,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.ex.JavaSdkUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.rt.execution.application.AppMain;
import com.intellij.rt.execution.application.AppMainV2;
import java.io.File;
@@ -52,11 +52,11 @@ public class ProcessProxyFactoryImpl extends ProcessProxyFactory {
JavaSdkUtil.addRtJar(javaParameters.getClassPath());
ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.defineProperty(AppMain.LAUNCHER_PORT_NUMBER, port);
vmParametersList.defineProperty(AppMain.LAUNCHER_BIN_PATH, binPath);
vmParametersList.defineProperty(AppMainV2.LAUNCHER_PORT_NUMBER, port);
vmParametersList.defineProperty(AppMainV2.LAUNCHER_BIN_PATH, binPath);
javaParameters.getProgramParametersList().prepend(mainClass);
javaParameters.setMainClass(AppMain.class.getName());
javaParameters.setMainClass(AppMainV2.class.getName());
}
return proxy;

View File

@@ -1 +1 @@
Premain-Class: com.intellij.rt.execution.application.AppMain
Premain-Class: com.intellij.rt.execution.application.AppMainV2

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ import java.util.Locale;
* @author ven
* @noinspection UseOfSystemOutOrSystemErr
*/
public class AppMain {
public class AppMainV2 {
public static final String LAUNCHER_PORT_NUMBER = "idea.launcher.port";
public static final String LAUNCHER_BIN_PATH = "idea.launcher.bin.path";