mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (updates deprecated API usages)
This commit is contained in:
+2
-17
@@ -22,6 +22,8 @@ package com.intellij.execution.configurations;
|
||||
import com.intellij.execution.CantRunException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
/** @deprecated use {@link SimpleJavaParameters#toCommandLine()} (to be removed in IDEA 2019) */
|
||||
@SuppressWarnings("unused")
|
||||
public class CommandLineBuilder {
|
||||
private CommandLineBuilder() { }
|
||||
|
||||
@@ -29,17 +31,6 @@ public class CommandLineBuilder {
|
||||
return javaParameters.toCommandLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* In order to avoid too long cmd problem dynamic classpath can be used - if allowed by both {@code dynamicClasspath} parameter
|
||||
* and project settings.
|
||||
*
|
||||
* @param javaParameters parameters.
|
||||
* @param project a project to get a dynamic classpath setting from.
|
||||
* @param dynamicClasspath whether system properties and project settings will be able to cause using dynamic classpath. If false,
|
||||
* classpath will always be passed through the command line.
|
||||
* @return a command line.
|
||||
* @throws CantRunException if there are problems with JDK setup.
|
||||
*/
|
||||
public static GeneralCommandLine createFromJavaParameters(final SimpleJavaParameters javaParameters,
|
||||
final Project project,
|
||||
final boolean dynamicClasspath) throws CantRunException {
|
||||
@@ -52,12 +43,6 @@ public class CommandLineBuilder {
|
||||
return javaParameters.toCommandLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param javaParameters parameters.
|
||||
* @param forceDynamicClasspath whether dynamic classpath will be used for this execution, to prevent problems caused by too long command line.
|
||||
* @return a command line.
|
||||
* @throws CantRunException if there are problems with JDK setup.
|
||||
*/
|
||||
public static GeneralCommandLine createFromJavaParameters(final SimpleJavaParameters javaParameters,
|
||||
final boolean forceDynamicClasspath) throws CantRunException {
|
||||
javaParameters.setUseDynamicClasspath(forceDynamicClasspath);
|
||||
|
||||
+5
-5
@@ -18,7 +18,6 @@ package com.intellij.execution.configurations;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class JavaCommandLineState extends CommandLineState implements JavaCommandLine {
|
||||
@@ -39,7 +38,7 @@ public abstract class JavaCommandLineState extends CommandLineState implements J
|
||||
public void clear() {
|
||||
myParams = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected OSProcessHandler startProcess() throws ExecutionException {
|
||||
@@ -53,11 +52,12 @@ public abstract class JavaCommandLineState extends CommandLineState implements J
|
||||
protected abstract JavaParameters createJavaParameters() throws ExecutionException;
|
||||
|
||||
protected GeneralCommandLine createCommandLine() throws ExecutionException {
|
||||
final Project project = getEnvironment().getProject();
|
||||
return CommandLineBuilder.createFromJavaParameters(getJavaParameters(), project, true);
|
||||
SimpleJavaParameters javaParameters = getJavaParameters();
|
||||
javaParameters.setUseDynamicClasspath(getEnvironment().getProject());
|
||||
return javaParameters.toCommandLine();
|
||||
}
|
||||
|
||||
public boolean shouldAddJavaProgramRunnerActions() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.execution.process;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.CommandLineBuilder;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -26,7 +25,7 @@ import java.nio.charset.Charset;
|
||||
/** @deprecated use {@link OSProcessHandler} (to be removed in IDEA 17) */
|
||||
public class DefaultJavaProcessHandler extends OSProcessHandler {
|
||||
public DefaultJavaProcessHandler(@NotNull JavaParameters javaParameters) throws ExecutionException {
|
||||
super(CommandLineBuilder.createFromJavaParameters(javaParameters));
|
||||
super(javaParameters.toCommandLine());
|
||||
}
|
||||
|
||||
public DefaultJavaProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
|
||||
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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 junit.framework.Assert;
|
||||
public class JavaCommandLineTest extends LightIdeaTestCase {
|
||||
public void testJdk() {
|
||||
try {
|
||||
CommandLineBuilder.createFromJavaParameters(new JavaParameters());
|
||||
new JavaParameters().toCommandLine();
|
||||
fail("CantRunException (main class is not specified) expected");
|
||||
}
|
||||
catch (CantRunException e) {
|
||||
@@ -40,7 +40,7 @@ public class JavaCommandLineTest extends LightIdeaTestCase {
|
||||
try {
|
||||
JavaParameters javaParameters = new JavaParameters();
|
||||
javaParameters.setJdk(getProjectJDK());
|
||||
CommandLineBuilder.createFromJavaParameters(javaParameters);
|
||||
javaParameters.toCommandLine();
|
||||
fail("CantRunException (main class is not specified) expected");
|
||||
}
|
||||
catch (CantRunException e) {
|
||||
@@ -52,7 +52,7 @@ public class JavaCommandLineTest extends LightIdeaTestCase {
|
||||
JavaParameters javaParameters = new JavaParameters();
|
||||
javaParameters.setJdk(getProjectJDK());
|
||||
javaParameters.setJarPath("my-jar-file.jar");
|
||||
String commandLineString = CommandLineBuilder.createFromJavaParameters(javaParameters).getCommandLineString();
|
||||
String commandLineString = javaParameters.toCommandLine().getCommandLineString();
|
||||
assertTrue(commandLineString, commandLineString.contains("-jar my-jar-file.jar"));
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class JavaCommandLineTest extends LightIdeaTestCase {
|
||||
javaParameters.setJdk(internalJdk);
|
||||
javaParameters.getClassPath().add("my-jar-file.jar");
|
||||
javaParameters.setMainClass("Main");
|
||||
commandLineString = CommandLineBuilder.createFromJavaParameters(javaParameters).getCommandLineString();
|
||||
commandLineString = javaParameters.toCommandLine().getCommandLineString();
|
||||
assertTrue(containsClassPath(commandLineString));
|
||||
|
||||
javaParameters = new JavaParameters();
|
||||
@@ -74,7 +74,7 @@ public class JavaCommandLineTest extends LightIdeaTestCase {
|
||||
javaParameters.setMainClass("Main");
|
||||
javaParameters.getVMParametersList().add("-cp");
|
||||
javaParameters.getVMParametersList().add("..");
|
||||
commandLineString = CommandLineBuilder.createFromJavaParameters(javaParameters).getCommandLineString();
|
||||
commandLineString = javaParameters.toCommandLine().getCommandLineString();
|
||||
commandLineString = removeClassPath(commandLineString, "-cp ..");
|
||||
assertTrue(!containsClassPath(commandLineString));
|
||||
|
||||
@@ -84,7 +84,7 @@ public class JavaCommandLineTest extends LightIdeaTestCase {
|
||||
javaParameters.setMainClass("Main");
|
||||
javaParameters.getVMParametersList().add("-classpath");
|
||||
javaParameters.getVMParametersList().add("..");
|
||||
commandLineString = CommandLineBuilder.createFromJavaParameters(javaParameters).getCommandLineString();
|
||||
commandLineString = javaParameters.toCommandLine().getCommandLineString();
|
||||
commandLineString = removeClassPath(commandLineString, "-classpath ..");
|
||||
assertTrue(!containsClassPath(commandLineString));
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
|
||||
@Override
|
||||
protected GeneralCommandLine createCommandLine() throws ExecutionException {
|
||||
return CommandLineBuilder.createFromJavaParameters(getJavaParameters());
|
||||
return getJavaParameters().toCommandLine();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -212,7 +212,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
|
||||
@Override
|
||||
protected GeneralCommandLine createCommandLine() throws ExecutionException {
|
||||
return CommandLineBuilder.createFromJavaParameters(getJavaParameters());
|
||||
return getJavaParameters().toCommandLine();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -270,7 +270,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
javaParameters.getVMParametersList().add(token);
|
||||
}
|
||||
|
||||
GeneralCommandLine commandLine = CommandLineBuilder.createFromJavaParameters(javaParameters);
|
||||
GeneralCommandLine commandLine = javaParameters.toCommandLine();
|
||||
|
||||
|
||||
DebuggerSession debuggerSession;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.lang.ant.config.execution;
|
||||
import com.intellij.concurrency.JobScheduler;
|
||||
import com.intellij.execution.CantRunException;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.CommandLineBuilder;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.process.*;
|
||||
import com.intellij.execution.testframework.Printable;
|
||||
@@ -122,7 +121,7 @@ public final class ExecutionHandler {
|
||||
builder.getCommandLine().setCharset(EncodingProjectManager.getInstance(buildFile.getProject()).getDefaultCharset());
|
||||
|
||||
messageView = prepareMessageView(buildMessageViewToReuse, buildFile, targets, additionalProperties);
|
||||
commandLine = CommandLineBuilder.createFromJavaParameters(builder.getCommandLine());
|
||||
commandLine = builder.getCommandLine().toCommandLine();
|
||||
messageView.setBuildCommandLine(commandLine.getCommandLineString());
|
||||
}
|
||||
catch (RunCanceledException e) {
|
||||
|
||||
+2
-5
@@ -24,10 +24,7 @@ import com.intellij.appengine.facet.AppEngineFacet;
|
||||
import com.intellij.appengine.sdk.AppEngineSdk;
|
||||
import com.intellij.appengine.util.AppEngineUtil;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.CommandLineBuilder;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
import com.intellij.execution.configurations.ParametersList;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.process.*;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
@@ -192,7 +189,7 @@ public class AppEngineUploader {
|
||||
programParameters.add("update");
|
||||
programParameters.add(FileUtil.toSystemDependentName(myArtifact.getOutputPath()));
|
||||
|
||||
final GeneralCommandLine commandLine = CommandLineBuilder.createFromJavaParameters(parameters);
|
||||
final GeneralCommandLine commandLine = parameters.toCommandLine();
|
||||
processHandler = new OSProcessHandler(commandLine);
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
|
||||
@@ -428,7 +428,7 @@ public abstract class MvcFramework {
|
||||
}
|
||||
|
||||
public static GeneralCommandLine createCommandLine(@NotNull JavaParameters params) throws CantRunException {
|
||||
return CommandLineBuilder.createFromJavaParameters(params);
|
||||
return params.toCommandLine();
|
||||
}
|
||||
|
||||
private void extractPlugins(Project project, @Nullable VirtualFile pluginRoot, boolean refreshPluginRoot, Map<String, VirtualFile> res) {
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.intellij.junit4;
|
||||
import com.intellij.execution.BaseConfigurationTestCase;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.ProgramRunnerUtil;
|
||||
import com.intellij.execution.configurations.CommandLineBuilder;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
import com.intellij.execution.executors.DefaultRunExecutor;
|
||||
@@ -145,7 +144,8 @@ public class JUnit4IntegrationTest extends BaseConfigurationTestCase {
|
||||
ExecutionEnvironment environment = new ExecutionEnvironment(executor, ProgramRunnerUtil.getRunner(DefaultRunExecutor.EXECUTOR_ID, settings), settings, getProject());
|
||||
TestObject state = configuration.getState(executor, environment);
|
||||
JavaParameters parameters = state.getJavaParameters();
|
||||
GeneralCommandLine commandLine = CommandLineBuilder.createFromJavaParameters(parameters, getProject(), true);
|
||||
parameters.setUseDynamicClasspath(getProject());
|
||||
GeneralCommandLine commandLine = parameters.toCommandLine();
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuffer err = new StringBuffer();
|
||||
OSProcessHandler process = new OSProcessHandler(commandLine);
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@
|
||||
package org.jetbrains.idea.maven.execution;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.CommandLineBuilder;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -67,7 +66,7 @@ public class MavenExternalExecutor extends MavenExecutor {
|
||||
}
|
||||
|
||||
myProcessHandler =
|
||||
new OSProcessHandler(CommandLineBuilder.createFromJavaParameters(myJavaParameters)) {
|
||||
new OSProcessHandler(myJavaParameters.toCommandLine()) {
|
||||
@Override
|
||||
public void notifyTextAvailable(String text, Key outputType) {
|
||||
// todo move this logic to ConsoleAdapter class
|
||||
|
||||
Reference in New Issue
Block a user