From bd6cfed4ecc358712a5a1bffc6fa2f5ed933fd9f Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Mon, 29 Feb 2016 19:54:00 +0300 Subject: [PATCH] minor refactoring --- .../debugger/jdi/VirtualMachineProxyImpl.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/VirtualMachineProxyImpl.java b/java/debugger/impl/src/com/intellij/debugger/jdi/VirtualMachineProxyImpl.java index 05e7e380cb07..e1fe0f996967 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/VirtualMachineProxyImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/VirtualMachineProxyImpl.java @@ -135,7 +135,7 @@ public class VirtualMachineProxyImpl implements JdiTimer, VirtualMachineProxy { candidates.removeAll(nested2); } - nestedTypes = candidates.isEmpty()? Collections.emptyList() : new ArrayList<>(candidates); + nestedTypes = candidates.isEmpty() ? Collections.emptyList() : new ArrayList<>(candidates); } else { nestedTypes = Collections.emptyList(); @@ -193,10 +193,7 @@ public class VirtualMachineProxyImpl implements JdiTimer, VirtualMachineProxy { public void threadStarted(ThreadReference thread) { DebuggerManagerThreadImpl.assertIsManagerThread(); - final Map allThreads = myAllThreads; - if (!allThreads.containsKey(thread)) { - allThreads.put(thread, new ThreadReferenceProxyImpl(this, thread)); - } + getThreadReferenceProxy(thread); // add a proxy } public void threadStopped(ThreadReference thread) { @@ -576,13 +573,7 @@ public class VirtualMachineProxyImpl implements JdiTimer, VirtualMachineProxy { return null; } - ThreadReferenceProxyImpl proxy = myAllThreads.get(thread); - if (proxy == null) { - proxy = new ThreadReferenceProxyImpl(this, thread); - myAllThreads.put(thread, proxy); - } - - return proxy; + return myAllThreads.computeIfAbsent(thread, t -> new ThreadReferenceProxyImpl(this, t)); } public ThreadGroupReferenceProxyImpl getThreadGroupReferenceProxy(ThreadGroupReference group) {