From ea7c3845b87174d88310732a05686d168ee431d2 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 13 Jan 2016 17:35:27 +0300 Subject: [PATCH] cleanup --- .../intellij/util/concurrency/BoundedTaskExecutorTest.java | 4 ++-- .../com/intellij/util/concurrency/BoundedTaskExecutor.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java b/platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java index 3ddfde6f5e11..1f39d04bd016 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/concurrency/BoundedTaskExecutorTest.java @@ -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. @@ -173,7 +173,7 @@ public class BoundedTaskExecutorTest extends TestCase { Future[] futures = new Future[N]; for (int i = 0; i < N; i++) { final int finalI = i; - futures[i] = executor.submit(() -> log.append(finalI).append(" ")); + futures[i] = executor.submit(() -> log.append(finalI+" ")); } for (int i = 0; i < N; i++) { expected.append(i).append(" "); diff --git a/platform/util/src/com/intellij/util/concurrency/BoundedTaskExecutor.java b/platform/util/src/com/intellij/util/concurrency/BoundedTaskExecutor.java index 2ea538cb54fd..339a2f94e990 100644 --- a/platform/util/src/com/intellij/util/concurrency/BoundedTaskExecutor.java +++ b/platform/util/src/com/intellij/util/concurrency/BoundedTaskExecutor.java @@ -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. @@ -19,6 +19,7 @@ import com.intellij.diagnostic.ThreadDumper; import com.intellij.openapi.Disposable; import com.intellij.openapi.util.Disposer; import com.intellij.util.Function; +import com.intellij.util.ObjectUtils; import com.intellij.util.ReflectionUtil; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; @@ -71,10 +72,10 @@ public class BoundedTaskExecutor extends AbstractExecutorService { // for diagnostics static Object info(Object task) { if (task instanceof FutureTask) { - task = ReflectionUtil.getField(task.getClass(), task, Callable.class, "callable"); + task = ObjectUtils.chooseNotNull(ReflectionUtil.getField(task.getClass(), task, Callable.class, "callable"), task.getClass()); } if (task instanceof Callable && task.getClass().getName().equals("java.util.concurrent.Executors$RunnableAdapter")) { - task = ReflectionUtil.getField(task.getClass(), task, Runnable.class, "task"); + task = ObjectUtils.chooseNotNull(ReflectionUtil.getField(task.getClass(), task, Runnable.class, "task"), task.getClass()); } return task; }