Cleanup (updates deprecated API usages)

This commit is contained in:
Roman Shevchenko
2016-12-02 13:48:03 +01:00
parent 13148178d9
commit 3ba30bfc6f
10 changed files with 27 additions and 48 deletions
@@ -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);
@@ -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;
}
}
}
@@ -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 {