From 38d34639da3d3f4ea33c3287e09ee58ca8f94ce3 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 9 Dec 2015 16:52:01 +0100 Subject: [PATCH] Cleanup (formatting) --- ...pturingAnsiEscapesAwareProcessHandler.java | 10 ++++----- .../process/CapturingProcessHandler.java | 11 +++------- .../process/ColoredProcessHandler.java | 13 +++++------- .../execution/process/OSProcessHandler.java | 14 +++++-------- .../KillableColoredProcessHandler.java | 8 +++---- .../intellij/execution/CommandLineUtil.java | 7 ++++--- .../process/BaseOSProcessHandler.java | 21 +++++++------------ .../execution/process/ProcessWaitFor.java | 18 +++++++--------- .../com/intellij/util/io/BaseDataReader.java | 8 +++---- 9 files changed, 43 insertions(+), 67 deletions(-) diff --git a/platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.java index 4dfa2e3faf54..015f24d03130 100644 --- a/platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.java @@ -26,15 +26,13 @@ import org.jetbrains.annotations.NotNull; * @author traff */ public class CapturingAnsiEscapesAwareProcessHandler extends CapturingProcessHandler { - public CapturingAnsiEscapesAwareProcessHandler(@NotNull GeneralCommandLine commandLine) - throws ExecutionException { + public CapturingAnsiEscapesAwareProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException { super(commandLine); } + /** @deprecated Use {@link #CapturingAnsiEscapesAwareProcessHandler(Process, String)} instead (to be removed in IDEA 17) */ + @SuppressWarnings({"deprecation", "unused"}) @Deprecated - /** - * @deprecated use {@link CapturingAnsiEscapesAwareProcessHandler#CapturingAnsiEscapesAwareProcessHandler(Process, String)} instead - */ public CapturingAnsiEscapesAwareProcessHandler(Process process) { super(process); } @@ -72,4 +70,4 @@ public class CapturingAnsiEscapesAwareProcessHandler extends CapturingProcessHan addToOutput(text, attributes); } } -} +} \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java index bf8249a12f9d..d37946444b95 100644 --- a/platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java @@ -39,25 +39,20 @@ public class CapturingProcessHandler extends OSProcessHandler { addProcessListener(createProcessAdapter(myOutput)); } + /** @deprecated Use {@link #CapturingProcessHandler(Process, Charset, String)} instead (to be removed in IDEA 17) */ @Deprecated - /** - * @deprecated Use {@link CapturingProcessHandler#CapturingProcessHandler(Process, Charset, String)} instead - */ public CapturingProcessHandler(@NotNull Process process) { this(process, null, ""); } + /** @deprecated Use {@link #CapturingProcessHandler(Process, Charset, String)} instead (to be removed in IDEA 17) */ @Deprecated - /** - * @deprecated Use {@link CapturingProcessHandler#CapturingProcessHandler(Process, Charset, String)} instead - */ public CapturingProcessHandler(@NotNull Process process, @Nullable Charset charset) { this(process, charset, ""); } /** - * - * @param commandLine must be not empty + * {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace) */ public CapturingProcessHandler(@NotNull Process process, @Nullable Charset charset, /*@NotNull*/ String commandLine) { super(process, commandLine, charset); diff --git a/platform/platform-api/src/com/intellij/execution/process/ColoredProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/ColoredProcessHandler.java index 1cd221c65326..073855648ab1 100644 --- a/platform/platform-api/src/com/intellij/execution/process/ColoredProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/ColoredProcessHandler.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.execution.process; import com.intellij.execution.ExecutionException; @@ -39,18 +38,16 @@ public class ColoredProcessHandler extends OSProcessHandler implements AnsiEscap } /** - * - * @param commandLine must be not empty + * {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace) */ - public ColoredProcessHandler(@NotNull Process process, /*@NotNull */String commandLine) { + public ColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine) { super(process, commandLine); } /** - * - * @param commandLine must be not empty + * {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace) */ - public ColoredProcessHandler(@NotNull Process process, /*@NotNull */String commandLine, @NotNull Charset charset) { + public ColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @NotNull Charset charset) { super(process, commandLine, charset); } @@ -94,4 +91,4 @@ public class ColoredProcessHandler extends OSProcessHandler implements AnsiEscap protected void textAvailable(final String text, final Key attributes) { super.notifyTextAvailable(text, attributes); } -} +} \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java index 1a463cfa647d..758031dbed29 100644 --- a/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java @@ -38,25 +38,21 @@ public class OSProcessHandler extends BaseOSProcessHandler { setHasPty(commandLine instanceof PtyCommandLine); } + /** @deprecated use {@link #OSProcessHandler(Process, String)} or any other ctor (to be removed in IDEA 17) */ @Deprecated - /** - * @deprecated use {@link OSProcessHandler#OSProcessHandler(Process, String)} or any other ctr instead - */ public OSProcessHandler(@NotNull Process process) { this(process, null); } /** - * - * @param commandLine must be not empty + * {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace) */ - public OSProcessHandler(@NotNull Process process, /*NotNull*/ String commandLine) { + public OSProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine) { this(process, commandLine, EncodingManager.getInstance().getDefaultCharset()); } /** - * - * @param commandLine must be not empty + * {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace) */ public OSProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @Nullable Charset charset) { super(process, commandLine, charset); @@ -159,4 +155,4 @@ public class OSProcessHandler extends BaseOSProcessHandler { return super.useNonBlockingRead(); } } -} +} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/execution/process/KillableColoredProcessHandler.java b/platform/platform-impl/src/com/intellij/execution/process/KillableColoredProcessHandler.java index 44cc96f535ae..a7b7c0c8dd36 100644 --- a/platform/platform-impl/src/com/intellij/execution/process/KillableColoredProcessHandler.java +++ b/platform/platform-impl/src/com/intellij/execution/process/KillableColoredProcessHandler.java @@ -54,16 +54,14 @@ public class KillableColoredProcessHandler extends ColoredProcessHandler impleme } /** - * - * @param commandLine must be not empty + * {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace) */ public KillableColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine) { super(process, commandLine); } /** - * - * @param commandLine must be not empty + * {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace) */ public KillableColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @NotNull Charset charset) { super(process, commandLine, charset); @@ -170,4 +168,4 @@ public class KillableColoredProcessHandler extends ColoredProcessHandler impleme public static KillableColoredProcessHandler create(@NotNull GeneralCommandLine commandLine) throws ExecutionException { return new KillableColoredProcessHandler(commandLine, true); } -} +} \ No newline at end of file diff --git a/platform/util/src/com/intellij/execution/CommandLineUtil.java b/platform/util/src/com/intellij/execution/CommandLineUtil.java index 27139d3a52d2..d2707c45ee44 100644 --- a/platform/util/src/com/intellij/execution/CommandLineUtil.java +++ b/platform/util/src/com/intellij/execution/CommandLineUtil.java @@ -98,11 +98,12 @@ public class CommandLineUtil { @NotNull public static String extractPresentableName(@NotNull String commandLine) { String executable = commandLine.trim(); + if (StringUtil.startsWithChar(executable, '\"') || StringUtil.startsWithChar(executable, '\'')) { char quote = executable.charAt(0); - for (int i=1;i(), ConcurrencyUtil.newNamedThreadFactory("OSProcessHandler pooled thread")); - @NotNull + /** @deprecated use {@link BaseOSProcessHandler#submit(Runnable)} instead (to be removed in IDEA 16) */ @Deprecated - /** - * todo remove in IDEA16 - * @deprecated use {@link BaseOSProcessHandler#submit(Runnable)} instead. - */ public static Future submit(@NotNull Runnable task) { return BaseOSProcessHandler.submit(task); } @@ -307,4 +302,4 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor public String toString() { return myCommandLine; } -} +} \ No newline at end of file diff --git a/platform/util/src/com/intellij/execution/process/ProcessWaitFor.java b/platform/util/src/com/intellij/execution/process/ProcessWaitFor.java index 5ed015818f56..51e5e6a00428 100644 --- a/platform/util/src/com/intellij/execution/process/ProcessWaitFor.java +++ b/platform/util/src/com/intellij/execution/process/ProcessWaitFor.java @@ -31,16 +31,10 @@ public class ProcessWaitFor { private final Future myWaitForThreadFuture; private final BlockingQueue> myTerminationCallback = new ArrayBlockingQueue>(1); - public void detach() { - myWaitForThreadFuture.cancel(true); - } - + /** @deprecated use {@link #ProcessWaitFor(Process, TaskExecutor, String)} instead (to be removed in IDEA 17) */ @Deprecated - /** - * @deprecated use {@link ProcessWaitFor#ProcessWaitFor(Process, TaskExecutor, String)} instead - */ public ProcessWaitFor(@NotNull final Process process, @NotNull TaskExecutor executor) { - this(process, executor,""); + this(process, executor, ""); } public ProcessWaitFor(@NotNull final Process process, @NotNull TaskExecutor executor, @NotNull final String presentableName) { @@ -49,7 +43,7 @@ public class ProcessWaitFor { public void run() { String oldThreadName = Thread.currentThread().getName(); if (!StringUtil.isEmptyOrSpaces(presentableName)) { - Thread.currentThread().setName(StringUtil.first("ProcessWaitFor: "+presentableName, 120, true)); + Thread.currentThread().setName(StringUtil.first("ProcessWaitFor: " + presentableName, 120, true)); } int exitCode = 0; try { @@ -78,7 +72,11 @@ public class ProcessWaitFor { }); } + public void detach() { + myWaitForThreadFuture.cancel(true); + } + public void setTerminationCallback(Consumer r) { myTerminationCallback.offer(r); } -} +} \ No newline at end of file diff --git a/platform/util/src/com/intellij/util/io/BaseDataReader.java b/platform/util/src/com/intellij/util/io/BaseDataReader.java index 750395af994e..29610d72ef59 100644 --- a/platform/util/src/com/intellij/util/io/BaseDataReader.java +++ b/platform/util/src/com/intellij/util/io/BaseDataReader.java @@ -39,10 +39,8 @@ public abstract class BaseDataReader { mySleepingPolicy = sleepingPolicy != null ? sleepingPolicy: SleepingPolicy.SIMPLE; } + /** @deprecated use {@link #start(String)} instead (to be removed in IDEA 17) */ @Deprecated - /** - * @deprecated use {@link BaseDataReader#start(String)} instead - */ protected void start() { start(""); } @@ -57,7 +55,7 @@ public abstract class BaseDataReader { public void run() { String oldThreadName = Thread.currentThread().getName(); if (!StringUtil.isEmptyOrSpaces(presentableName)) { - Thread.currentThread().setName(StringUtil.first("BaseDataReader: "+presentableName, 120, true)); + Thread.currentThread().setName(StringUtil.first("BaseDataReader: " + presentableName, 120, true)); } try { doRun(); @@ -168,4 +166,4 @@ public abstract class BaseDataReader { LOG.error(e); } } -} +} \ No newline at end of file