mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -203,7 +203,7 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
|
||||
});
|
||||
if (lambdas.size() > 1) {
|
||||
ArrayList<Method> lambdasList = new ArrayList<>(lambdas);
|
||||
Collections.sort(lambdasList, DebuggerUtilsEx.LAMBDA_ORDINAL_COMPARATOR);
|
||||
lambdasList.sort(DebuggerUtilsEx.LAMBDA_ORDINAL_COMPARATOR);
|
||||
lambdaOrdinal = lambdasList.indexOf(method);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ public abstract class SuspendContextImpl extends XSuspendContext implements Susp
|
||||
currentStack = stack;
|
||||
}
|
||||
}
|
||||
Collections.sort(res, THREADS_COMPARATOR);
|
||||
res.sort(THREADS_COMPARATOR);
|
||||
if (currentStack != null) {
|
||||
res.add(0, currentStack);
|
||||
}
|
||||
|
||||
@@ -949,7 +949,7 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
}
|
||||
|
||||
public static final Comparator<Method> LAMBDA_ORDINAL_COMPARATOR =
|
||||
(m1, m2) -> LambdaMethodFilter.getLambdaOrdinal(m1.name()) - LambdaMethodFilter.getLambdaOrdinal(m2.name());
|
||||
Comparator.comparingInt(m -> LambdaMethodFilter.getLambdaOrdinal(m.name()));
|
||||
|
||||
public static void disableCollection(ObjectReference reference) {
|
||||
try {
|
||||
|
||||
@@ -145,12 +145,7 @@ public class HotSwapManager extends AbstractProjectComponent {
|
||||
for (Pair<DebuggerSession, Long> pair : sessionWithStamps) {
|
||||
final DebuggerSession session = pair.first;
|
||||
if (fileStamp > pair.second) {
|
||||
Map<String, HotSwapFile> container = result.get(session);
|
||||
if (container == null) {
|
||||
container = new java.util.HashMap<>();
|
||||
result.put(session, container);
|
||||
}
|
||||
container.put(qualifiedName, hotswapFile);
|
||||
result.computeIfAbsent(session, k -> new java.util.HashMap<>()).put(qualifiedName, hotswapFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,13 +298,7 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent {
|
||||
public void fileGenerated(String outputRoot, String relativePath) {
|
||||
if (StringUtil.endsWith(relativePath, ".class") && JpsPathUtil.isUnder(myOutputRoots, new File(outputRoot))) {
|
||||
// collect only classes
|
||||
final Map<String, List<String>> map = myGeneratedPaths.get();
|
||||
List<String> paths = map.get(outputRoot);
|
||||
if (paths == null) {
|
||||
paths = new ArrayList<>();
|
||||
map.put(outputRoot, paths);
|
||||
}
|
||||
paths.add(relativePath);
|
||||
myGeneratedPaths.get().computeIfAbsent(outputRoot, k -> new ArrayList<>()).add(relativePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class RunHotswapDialog extends OptionsDialog {
|
||||
for (DebuggerSession session : sessions) {
|
||||
items.add(new SessionItem(session));
|
||||
}
|
||||
Collections.sort(items, (debuggerSession, debuggerSession1) -> debuggerSession.getSession().getSessionName().compareTo(debuggerSession1.getSession().getSessionName()));
|
||||
items.sort(Comparator.comparing(debuggerSession -> debuggerSession.getSession().getSessionName()));
|
||||
myElementsChooser = new ElementsChooser<>(items, true);
|
||||
myPanel.setBorder(IdeBorderFactory.createEmptyBorder(10, 0, 5, 0));
|
||||
//myElementsChooser.setBorder(IdeBorderFactory.createEmptyBorder(5, 0, 0, 0));
|
||||
|
||||
@@ -144,7 +144,7 @@ public class ThreadsDebuggerTree extends DebuggerTree {
|
||||
root.insert(nodeManager.createNode(nodeManager.getThreadDescriptor(null, currentThread), evaluationContext), 0);
|
||||
}
|
||||
List<ThreadReferenceProxyImpl> allThreads = new ArrayList<>(vm.allThreads());
|
||||
Collections.sort(allThreads, ThreadReferenceProxyImpl.ourComparator);
|
||||
allThreads.sort(ThreadReferenceProxyImpl.ourComparator);
|
||||
|
||||
for (ThreadReferenceProxyImpl threadProxy : allThreads) {
|
||||
if (threadProxy.equals(currentThread)) {
|
||||
|
||||
@@ -491,7 +491,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
try {
|
||||
buildVariables(stackDescriptor, evaluationContext);
|
||||
if (XDebuggerSettingsManager.getInstance().getDataViewSettings().isSortValues()) {
|
||||
Collections.sort(myChildren, NodeManagerImpl.getNodeComparator());
|
||||
myChildren.sort(NodeManagerImpl.getNodeComparator());
|
||||
}
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
@@ -686,7 +686,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
ThreadGroupReferenceProxyImpl threadGroup = groupDescriptor.getThreadGroupReference();
|
||||
|
||||
List<ThreadReferenceProxyImpl> threads = new ArrayList<>(threadGroup.threads());
|
||||
Collections.sort(threads, ThreadReferenceProxyImpl.ourComparator);
|
||||
threads.sort(ThreadReferenceProxyImpl.ourComparator);
|
||||
|
||||
final DebuggerContextImpl debuggerContext = getDebuggerContext();
|
||||
final SuspendContextImpl suspendContext = debuggerContext.getSuspendContext();
|
||||
|
||||
@@ -48,7 +48,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -178,7 +177,7 @@ public class ClassRenderer extends NodeRendererImpl{
|
||||
children.add(nodeManager.createMessageNode(DebuggerBundle.message("message.node.class.no.fields.to.display")));
|
||||
}
|
||||
else if (XDebuggerSettingsManager.getInstance().getDataViewSettings().isSortValues()) {
|
||||
Collections.sort(children, NodeManagerImpl.getNodeComparator());
|
||||
children.sort(NodeManagerImpl.getNodeComparator());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-5
@@ -45,11 +45,7 @@ public class XDebuggerHistoryManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
LinkedList<XExpression> list = myRecentExpressions.get(id);
|
||||
if (list == null) {
|
||||
list = new LinkedList<>();
|
||||
myRecentExpressions.put(id, list);
|
||||
}
|
||||
LinkedList<XExpression> list = myRecentExpressions.computeIfAbsent(id, k -> new LinkedList<>());
|
||||
if (list.size() == MAX_RECENT_EXPRESSIONS) {
|
||||
list.removeLast();
|
||||
}
|
||||
|
||||
+3
-6
@@ -54,10 +54,7 @@ import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class AttachToLocalProcessAction extends AnAction {
|
||||
private static final Key<LinkedHashMap<String, HistoryItem>> HISTORY_KEY = Key.create("AttachToLocalProcessAction.HISTORY_KEY");
|
||||
@@ -149,13 +146,13 @@ public class AttachToLocalProcessAction extends AnAction {
|
||||
}
|
||||
|
||||
ArrayList<XLocalAttachGroup> sortedGroups = new ArrayList<>(groupWithItems.keySet());
|
||||
Collections.sort(sortedGroups, (a, b) -> a.getOrder() - b.getOrder());
|
||||
sortedGroups.sort(Comparator.comparingInt(XLocalAttachGroup::getOrder));
|
||||
|
||||
List<AttachItem> currentItems = new ArrayList<>();
|
||||
for (final XLocalAttachGroup eachGroup : sortedGroups) {
|
||||
List<Pair<ProcessInfo, ArrayList<XLocalAttachDebugger>>> sortedItems
|
||||
= new ArrayList<>(groupWithItems.get(eachGroup));
|
||||
Collections.sort(sortedItems, (a, b) -> eachGroup.compare(project, a.first, b.first, dataHolder));
|
||||
sortedItems.sort((a, b) -> eachGroup.compare(project, a.first, b.first, dataHolder));
|
||||
|
||||
boolean first = true;
|
||||
for (Pair<ProcessInfo, ArrayList<XLocalAttachDebugger>> eachItem : sortedItems) {
|
||||
|
||||
+2
-12
@@ -289,12 +289,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
|
||||
}
|
||||
|
||||
private <T extends XBreakpointProperties> EventDispatcher<XBreakpointListener> getOrCreateDispatcher(final XBreakpointType<?,T> type) {
|
||||
EventDispatcher<XBreakpointListener> dispatcher = myDispatchers.get(type);
|
||||
if (dispatcher == null) {
|
||||
dispatcher = EventDispatcher.create(XBreakpointListener.class);
|
||||
myDispatchers.put(type, dispatcher);
|
||||
}
|
||||
return dispatcher;
|
||||
return myDispatchers.computeIfAbsent(type, k -> EventDispatcher.create(XBreakpointListener.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -496,12 +491,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
|
||||
|
||||
@NotNull
|
||||
public BreakpointState getBreakpointDefaults(@NotNull XBreakpointType type) {
|
||||
BreakpointState defaultState = myBreakpointsDefaults.get(type);
|
||||
if (defaultState == null) {
|
||||
defaultState = createBreakpointDefaults(type);
|
||||
myBreakpointsDefaults.put(type, defaultState);
|
||||
}
|
||||
return defaultState;
|
||||
return myBreakpointsDefaults.computeIfAbsent(type, k -> createBreakpointDefaults(type));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -390,7 +390,7 @@ public class BreakpointsDialog extends DialogWrapper {
|
||||
for (BreakpointPanelProvider provider : myBreakpointsPanelProviders) {
|
||||
provider.createBreakpointsGroupingRules(myRulesAvailable);
|
||||
}
|
||||
Collections.sort(myRulesAvailable, XBreakpointGroupingRule.PRIORITY_COMPARATOR);
|
||||
myRulesAvailable.sort(XBreakpointGroupingRule.PRIORITY_COMPARATOR);
|
||||
|
||||
myRulesEnabled.clear();
|
||||
XBreakpointsDialogState settings = (getBreakpointManager()).getBreakpointsDialogSettings();
|
||||
|
||||
+1
-5
@@ -120,11 +120,7 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter {
|
||||
res.add(new LineExtensionInfo(" " + name + ": ", attributes));
|
||||
|
||||
Variable var = new Variable(name, lineNumber);
|
||||
VariableValue variableValue = oldValues.get(var);
|
||||
if (variableValue == null) {
|
||||
variableValue = new VariableValue(text.toString(), null, value.hashCode());
|
||||
oldValues.put(var, variableValue);
|
||||
}
|
||||
VariableValue variableValue = oldValues.computeIfAbsent(var, k -> new VariableValue(text.toString(), null, value.hashCode()));
|
||||
if (variableValue.valueNodeHashCode != value.hashCode()) {
|
||||
variableValue.old = variableValue.actual;
|
||||
variableValue.actual = text.toString();
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.intellij.xdebugger.frame.XExecutionStack;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.intellij.xdebugger.frame.XSuspendContext;
|
||||
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import gnu.trove.TObjectIntHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -192,12 +191,7 @@ public class XFramesView extends XDebugView {
|
||||
}
|
||||
|
||||
private StackFramesListBuilder getOrCreateBuilder(XExecutionStack executionStack, XDebugSession session) {
|
||||
StackFramesListBuilder builder = myBuilders.get(executionStack);
|
||||
if (builder == null) {
|
||||
builder = new StackFramesListBuilder(executionStack, session);
|
||||
myBuilders.put(executionStack, builder);
|
||||
}
|
||||
return builder;
|
||||
return myBuilders.computeIfAbsent(executionStack, k -> new StackFramesListBuilder(executionStack, session));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -156,12 +156,7 @@ public class XVariablesView extends XVariablesViewBase implements DataProvider {
|
||||
public void put(@NotNull VirtualFile file, @NotNull XSourcePosition position, @NotNull XValueNodeImpl node) {
|
||||
synchronized (myData) {
|
||||
Pair<VirtualFile, Integer> key = Pair.create(file, position.getLine());
|
||||
Set<Entry> entries = myData.get(key);
|
||||
if (entries == null) {
|
||||
entries = new TreeSet<>();
|
||||
myData.put(key, entries);
|
||||
}
|
||||
entries.add(new Entry(position.getOffset(), node));
|
||||
myData.computeIfAbsent(key, k -> new TreeSet<>()).add(new Entry(position.getOffset(), node));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ public abstract class XBreakpointsTestCase extends XDebuggerTestCase {
|
||||
result.add(breakpoint);
|
||||
}
|
||||
}
|
||||
Collections.sort(result, (o1, o2) -> StringUtil.compare(((MyBreakpointProperties)o1.getProperties()).myOption,
|
||||
((MyBreakpointProperties)o2.getProperties()).myOption, true));
|
||||
result.sort((o1, o2) -> StringUtil.compare(((MyBreakpointProperties)o1.getProperties()).myOption,
|
||||
((MyBreakpointProperties)o2.getProperties()).myOption, true));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user