mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -118,8 +118,7 @@ public class TreeUtil {
|
||||
}
|
||||
|
||||
public static boolean isLeafOrCollapsedChameleon(ASTNode node) {
|
||||
return node instanceof LeafElement ||
|
||||
node instanceof LazyParseableElement && !((LazyParseableElement)node).isParsed();
|
||||
return node instanceof LeafElement || isCollapsedChameleon(node);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+2
-1
@@ -208,7 +208,8 @@ public abstract class VirtualFileSystemEntry extends NewVirtualFile {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myId >= 0 ? myId : -myId;
|
||||
int id = myId;
|
||||
return id >= 0 ? id : -id;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -18,13 +18,13 @@ package com.intellij.openapi.util;
|
||||
import com.intellij.openapi.Forceable;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -33,7 +33,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
public class LowMemoryWatcher {
|
||||
private static final long MEM_THRESHOLD = 5 /*MB*/ * 1024 * 1024;
|
||||
|
||||
public static abstract class ForceableAdapter implements Forceable {
|
||||
public abstract static class ForceableAdapter implements Forceable {
|
||||
public boolean isDirty() {
|
||||
return true;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class LowMemoryWatcher {
|
||||
private static final ReferenceQueue<Object> ourRefQueue = new ReferenceQueue<Object>();
|
||||
@SuppressWarnings({"FieldCanBeLocal"})
|
||||
private static SoftReference<Object> ourRef;
|
||||
private static final List<WeakReference<LowMemoryWatcher>> ourInstances = new CopyOnWriteArrayList<WeakReference<LowMemoryWatcher>>();
|
||||
private static final List<WeakReference<LowMemoryWatcher>> ourInstances = ContainerUtil.createEmptyCOWList();
|
||||
|
||||
private final Forceable myForceable;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class LowMemoryWatcher {
|
||||
|
||||
if (!shouldCleanup) {
|
||||
final Runtime runtime = Runtime.getRuntime();
|
||||
shouldCleanup = (runtime.maxMemory() - runtime.totalMemory()) <= MEM_THRESHOLD;
|
||||
shouldCleanup = runtime.maxMemory() - runtime.totalMemory() <= MEM_THRESHOLD;
|
||||
}
|
||||
|
||||
for (WeakReference<LowMemoryWatcher> instanceRef : ourInstances) {
|
||||
|
||||
@@ -827,7 +827,7 @@ public class ContainerUtil {
|
||||
|
||||
@NotNull
|
||||
public static <T> List<T> createMaybeSingletonList(@Nullable T element) {
|
||||
return element == null ? Collections.<T>emptyList() : Arrays.asList(element);
|
||||
return element == null ? Collections.<T>emptyList() : Collections.singletonList(element);
|
||||
}
|
||||
|
||||
public static <T, V> V getOrCreate(@NotNull Map<T, V> result, final T key, final V defaultValue) {
|
||||
@@ -955,7 +955,7 @@ public class ContainerUtil {
|
||||
if ((s = d - c) > 1) quickSort(x, comparator, n - s, s);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the index of the median of the three indexed longs.
|
||||
*/
|
||||
private static <T> int med3(@NotNull List<T> x, Comparator<? super T> comparator, int a, int b, int c) {
|
||||
@@ -967,7 +967,7 @@ public class ContainerUtil {
|
||||
: comparator.compare(x.get(c), x.get(a)) < 0 ? c : a;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Swaps x[a .. (a+n-1)] with x[b .. (b+n-1)].
|
||||
*/
|
||||
private static <T> void vecswap(List<T> x, int a, int b, int n) {
|
||||
|
||||
Reference in New Issue
Block a user