This commit is contained in:
Alexey Kudravtsev
2011-02-09 18:32:22 +03:00
parent 644a7e8517
commit 9fb8f640f1
8 changed files with 21 additions and 30 deletions
@@ -528,10 +528,7 @@ public class GlobalInspectionContextImpl implements GlobalInspectionContext {
if (virtualFile != null) {
incrementJobDoneAmount(LOCAL_ANALYSIS, ProjectUtil.calcRelativeToProjectPath(virtualFile, myProject));
if (SingleRootFileViewProvider.isTooLarge(virtualFile)) return;
if (localScopeFiles != null) {
if (localScopeFiles.contains(virtualFile)) return;
localScopeFiles.add(virtualFile);
}
if (localScopeFiles != null && !localScopeFiles.add(virtualFile)) return;
}
final FileViewProvider viewProvider = psiManager.findViewProvider(virtualFile);
@@ -32,7 +32,7 @@ public abstract class CodeStyleFacade {
return ServiceManager.getService(CodeStyleFacade.class);
}
public static CodeStyleFacade getInstance(Project project) {
public static CodeStyleFacade getInstance(@Nullable Project project) {
if (project == null) return getInstance();
return ServiceManager.getService(project, CodeStyleFacade.class);
}
@@ -57,7 +57,7 @@ public class IndentSelectionAction extends EditorAction {
return editor.getSelectionModel().hasSelection() && !editor.isOneLineMode();
}
public static void indentSelection(Editor editor, Project project) {
private static void indentSelection(Editor editor, Project project) {
if(!editor.getSelectionModel().hasSelection())
return;
@@ -80,7 +80,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
private boolean myGuardsSuppressed = false;
private boolean myEventsHandling = false;
private final boolean myAssertWriteAccess;
private boolean myDoingBulkUpdate = false;
private volatile boolean myDoingBulkUpdate = false;
private static final Key<WeakReference<EditorHighlighter>> ourSomeEditorSyntaxHighlighter = Key.create("some editor highlighter");
private boolean myAcceptSlashR = false;
@@ -252,7 +252,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
public RangeMarker getRangeGuard(int start, int end) {
for (RangeMarker block : myGuardedBlocks) {
if (rangesIntersect(start, block.getStartOffset(), end, block.getEndOffset(), true, block.isGreedyToLeft(), true, block.isGreedyToRight())) {
if (rangesIntersect(start, true, block.getStartOffset(), block.isGreedyToLeft(), end, true, block.getEndOffset(), block.isGreedyToRight())) {
return block;
}
}
@@ -273,14 +273,15 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
return start <= offset && offset < end;
}
private static boolean rangesIntersect(int start0, int start1, int end0, int end1, boolean leftInclusive0, boolean leftInclusive1, boolean rightInclusive0, boolean rightInclusive1) {
private static boolean rangesIntersect(int start0, boolean leftInclusive0,
int start1, boolean leftInclusive1,
int end0, boolean rightInclusive0,
int end1, boolean rightInclusive1) {
if (start0 > start1 || start0 == start1 && !leftInclusive0) {
return rangesIntersect(start1, start0, end1, end0, leftInclusive1, leftInclusive0, rightInclusive1, rightInclusive0);
return rangesIntersect(start1, leftInclusive1, start0, leftInclusive0, end1, rightInclusive1, end0, rightInclusive0);
}
if (end0 < start1) return false;
if (end0 > start1) return true;
return leftInclusive1 && rightInclusive0;
if (end0 == start1) return leftInclusive1 && rightInclusive0;
return end0 > start1;
}
@NotNull
@@ -20,14 +20,13 @@ import com.intellij.openapi.editor.markup.TextAttributes;
import org.jetbrains.annotations.NotNull;
public class TextChunk {
public static final TextChunk[] EMPTY_ARRAY = new TextChunk[0];
public static final TextChunk[] EMPTY_ARRAY = new TextChunk[0];
private final AttributesFlyweight myAttributes;
private final String myText;
public TextChunk(@NotNull TextAttributes attributesKey, @NotNull String text) {
myAttributes = attributesKey.getFlyweight();
public TextChunk(@NotNull TextAttributes attributes, @NotNull String text) {
myAttributes = attributes.getFlyweight();
myText = text;
}
@@ -28,7 +28,7 @@ import java.util.Set;
public class Comparing {
private Comparing() { }
public static <T> boolean equal(T arg1, T arg2){
public static <T> boolean equal(T arg1, T arg2){
if (arg1 == null || arg2 == null){
return arg1 == arg2;
}
@@ -30,20 +30,14 @@ public class UniqueResultsQuery<T, M> implements Query<T> {
private final TObjectHashingStrategy<M> myHashingStrategy;
private final Function<T, M> myMapper;
public static final Function ID = new Function() {
public Object fun(Object o) {
return o;
}
};
public UniqueResultsQuery(final Query<T> original) {
//noinspection unchecked
this(original, TObjectHashingStrategy.CANONICAL, ID);
this(original, TObjectHashingStrategy.CANONICAL, Function.ID);
}
public UniqueResultsQuery(final Query<T> original, TObjectHashingStrategy<M> hashingStrategy) {
//noinspection unchecked
this(original, hashingStrategy, ID);
this(original, hashingStrategy, Function.ID);
}
public UniqueResultsQuery(final Query<T> original, TObjectHashingStrategy<M> hashingStrategy, Function<T, M> mapper) {
@@ -70,7 +64,7 @@ public class UniqueResultsQuery<T, M> implements Query<T> {
@NotNull
public Collection<T> findAll() {
if (myMapper == ID) {
if (myMapper == Function.ID) {
Set<M> set = new THashSet<M>(myHashingStrategy);
process(CommonProcessors.<T>alwaysTrue(), Collections.synchronizedSet(set));
//noinspection unchecked
@@ -53,7 +53,7 @@ public class BooleanMethodIsAlwaysInvertedInspection extends GlobalJavaInspectio
RefMethod refMethod = (RefMethod)refEntity;
if (!refMethod.isReferenced()) return null;
if (hasNonInvertedCalls(refMethod)) return null;
if (refMethod.getSuperMethods().size() > 0) return null;
if (!refMethod.getSuperMethods().isEmpty()) return null;
final PsiMethod psiMethod = (PsiMethod)refMethod.getElement();
final PsiIdentifier psiIdentifier = psiMethod.getNameIdentifier();
if (psiIdentifier != null) {
@@ -114,7 +114,7 @@ public class BooleanMethodIsAlwaysInvertedInspection extends GlobalJavaInspectio
final PsiElement psiElement = refMethod.getElement();
if (!(psiElement instanceof PsiMethod)) return;
final PsiMethod psiMethod = (PsiMethod)psiElement;
if (!(PsiType.BOOLEAN.equals(psiMethod.getReturnType()))) return;
if (!PsiType.BOOLEAN.equals(psiMethod.getReturnType())) return;
element.accept(new JavaRecursiveElementVisitor() {
@Override public void visitMethodCallExpression(PsiMethodCallExpression call) {
super.visitMethodCallExpression(call);