replaced VirtualFile' == comparisons with .equals()

This commit is contained in:
Alexey Kudravtsev
2012-07-11 13:21:25 +04:00
parent 4adea567a6
commit f782cc6517
106 changed files with 5271 additions and 5174 deletions
@@ -20,6 +20,7 @@ import com.intellij.ide.highlighter.JavaClassFileType;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
@@ -314,7 +315,7 @@ public abstract class JavaFileManagerBase implements JavaFileManager, Disposable
final VirtualFile root = ProjectRootManager.getInstance(myManager.getProject()).getFileIndex().getClassRootForFile(vFile);
VirtualFile parent = vFile.getParent();
final PsiNameHelper nameHelper = JavaPsiFacade.getInstance(myManager.getProject()).getNameHelper();
while (parent != null && parent != root) {
while (parent != null && !Comparing.equal(parent, root)) {
if (!nameHelper.isIdentifier(parent.getName())) return false;
parent = parent.getParent();
}
@@ -332,7 +333,7 @@ public abstract class JavaFileManagerBase implements JavaFileManager, Disposable
final ProjectFileIndex fileIndex = rootManager.getFileIndex();
for (final VirtualFile sourceRoot : sourceRoots) {
final String packageName = fileIndex.getPackageNameByDirectory(sourceRoot);
if (packageName != null && packageName.length() > 0) {
if (packageName != null && !packageName.isEmpty()) {
names.add(packageName);
}
}
@@ -1,9 +1,25 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi.impl.search;
import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -179,7 +195,7 @@ public class JavaDirectInheritorsSearcher implements QueryExecutor<PsiClass, Dir
VirtualFile jarFile = PsiUtil.getJarFile(aClass);
if (jarFile != null) {
for (PsiClass sameNamedClass : sameNamedClasses) {
boolean fromSameJar = PsiUtil.getJarFile(sameNamedClass) == jarFile;
boolean fromSameJar = Comparing.equal(PsiUtil.getJarFile(sameNamedClass), jarFile);
if (fromSameJar) {
sameJarClassFound = true;
if (!consumer.process(sameNamedClass)) return false;