mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+28
-14
@@ -28,12 +28,10 @@ import com.intellij.codeInspection.dataFlow.instructions.Instruction;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class DfaInstructionState implements Comparable<DfaInstructionState> {
|
||||
public static final DfaInstructionState[] EMPTY_ARRAY = new DfaInstructionState[0];
|
||||
@@ -96,15 +94,16 @@ class StateQueue {
|
||||
}
|
||||
|
||||
if (memoryStates.size() > 1 && joinInstructions.contains(instruction)) {
|
||||
StateMerger merger = new StateMerger();
|
||||
while (true) {
|
||||
List<DfaMemoryStateImpl> nextStates = merger.mergeByEquality(memoryStates);
|
||||
if (nextStates == null) nextStates = merger.mergeByType(memoryStates);
|
||||
if (nextStates == null) nextStates = merger.mergeByNullability(memoryStates);
|
||||
if (nextStates == null) nextStates = merger.mergeByUnknowns(memoryStates);
|
||||
if (nextStates == null) break;
|
||||
memoryStates = nextStates;
|
||||
MultiMap<Object, DfaMemoryStateImpl> groups = MultiMap.create();
|
||||
for (DfaMemoryStateImpl memoryState : memoryStates) {
|
||||
groups.putValue(memoryState.getSuperficialKey(), memoryState);
|
||||
}
|
||||
|
||||
memoryStates = ContainerUtil.newArrayList();
|
||||
for (Map.Entry<Object, Collection<DfaMemoryStateImpl>> entry : groups.entrySet()) {
|
||||
memoryStates.addAll(mergeGroup((List<DfaMemoryStateImpl>)entry.getValue()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ContainerUtil.map(memoryStates, new Function<DfaMemoryStateImpl, DfaInstructionState>() {
|
||||
@@ -113,7 +112,22 @@ class StateQueue {
|
||||
return new DfaInstructionState(instruction, state);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static List<DfaMemoryStateImpl> mergeGroup(List<DfaMemoryStateImpl> group) {
|
||||
if (group.size() < 2) {
|
||||
return group;
|
||||
}
|
||||
|
||||
StateMerger merger = new StateMerger();
|
||||
while (true) {
|
||||
List<DfaMemoryStateImpl> nextStates = merger.mergeByEquality(group);
|
||||
if (nextStates == null) nextStates = merger.mergeByType(group);
|
||||
if (nextStates == null) nextStates = merger.mergeByNullability(group);
|
||||
if (nextStates == null) nextStates = merger.mergeByUnknowns(group);
|
||||
if (nextStates == null) break;
|
||||
group = nextStates;
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+6
-1
@@ -26,6 +26,7 @@ package com.intellij.codeInspection.dataFlow;
|
||||
|
||||
import com.intellij.codeInspection.dataFlow.value.*;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.UnorderedPair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
@@ -101,7 +102,11 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
return myUnknownVariables.equals(that.myUnknownVariables);
|
||||
}
|
||||
|
||||
boolean equalsSuperficially(DfaMemoryStateImpl other) {
|
||||
Object getSuperficialKey() {
|
||||
return Pair.create(myEphemeral, myStack);
|
||||
}
|
||||
|
||||
private boolean equalsSuperficially(DfaMemoryStateImpl other) {
|
||||
return myEphemeral == other.myEphemeral && myStack.equals(other.myStack);
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class StateMerger {
|
||||
List<DfaMemoryStateImpl> complementary = ContainerUtil.filter(similarStates, new Condition<DfaMemoryStateImpl>() {
|
||||
@Override
|
||||
public boolean value(DfaMemoryStateImpl state2) {
|
||||
return state1.equalsSuperficially(state2) && state1.equalsByRelations(state2) && state1.equalsByVariableStates(state2);
|
||||
return state1.equalsByRelations(state2) && state1.equalsByVariableStates(state2);
|
||||
}
|
||||
});
|
||||
if (complementary.size() > 1) {
|
||||
@@ -162,8 +162,7 @@ class StateMerger {
|
||||
List<DfaMemoryStateImpl> complementary = ContainerUtil.filter(similarStates, new Condition<DfaMemoryStateImpl>() {
|
||||
@Override
|
||||
public boolean value(DfaMemoryStateImpl state2) {
|
||||
return state1.equalsSuperficially(state2) &&
|
||||
state1.equalsByRelations(state2) &&
|
||||
return state1.equalsByRelations(state2) &&
|
||||
areEquivalentModuloVar(state1, state2, var) &&
|
||||
areVarStatesEqualModuloNullability(state1, state2, var);
|
||||
}
|
||||
@@ -300,9 +299,6 @@ class StateMerger {
|
||||
}
|
||||
|
||||
private boolean seemCompatible(DfaMemoryStateImpl state1, DfaMemoryStateImpl state2, DfaVariableValue differentVar) {
|
||||
if (!state1.equalsSuperficially(state2)) {
|
||||
return false;
|
||||
}
|
||||
Map<DfaVariableValue, DfaConstValue> varValues1 = getVarValues(state1);
|
||||
Map<DfaVariableValue, DfaConstValue> varValues2 = getVarValues(state2);
|
||||
|
||||
|
||||
@@ -338,27 +338,37 @@ class RootIndex {
|
||||
DirectoryInfo info = myInfoCache.get(root);
|
||||
if (info != null) {
|
||||
if (dir != root) {
|
||||
myInfoCache.put(dir, info);
|
||||
cacheInfos(dir, root, info);
|
||||
}
|
||||
return info == NULL_INFO ? null : info;
|
||||
}
|
||||
|
||||
info = myRoots.get(root);
|
||||
if (info != null) {
|
||||
myInfoCache.put(dir, info);
|
||||
cacheInfos(dir, root, info);
|
||||
return info;
|
||||
}
|
||||
|
||||
if (isAnyExcludeRoot(root) || FileTypeManager.getInstance().isFileIgnored(root)) {
|
||||
myInfoCache.put(dir, NULL_INFO);
|
||||
cacheInfos(dir, root, NULL_INFO);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
myInfoCache.put(dir, NULL_INFO);
|
||||
cacheInfos(dir, null, NULL_INFO);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void cacheInfos(VirtualFile dir, @Nullable VirtualFile stopAt, @NotNull DirectoryInfo info) {
|
||||
while (dir != null) {
|
||||
myInfoCache.put(dir, info);
|
||||
if (dir == stopAt) {
|
||||
break;
|
||||
}
|
||||
dir = dir.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAnyExcludeRoot(VirtualFile root) {
|
||||
return myModuleExcludedRoots.contains(root) || myLibraryExcludedRoots.contains(root);
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ public class JBTerminalPanel extends TerminalPanel implements FocusListener, Ter
|
||||
|
||||
@Override
|
||||
protected void setupAntialiasing(Graphics graphics) {
|
||||
UIUtil.setupComposite((Graphics2D)graphics);
|
||||
UISettings.setupAntialiasing(graphics);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ class JBTerminalSystemSettingsProvider extends DefaultTabbedSettingsProvider imp
|
||||
|
||||
@Override
|
||||
public boolean useAntialiasing() {
|
||||
return UISettings.getInstance().ANTIALIASING_IN_EDITOR;
|
||||
return true; // we return true here because all the settings are checked again in UiSettings.setupAntialiasing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user