Removed AltClassFinder, since alt-headers are removed.
This commit is contained in:
+8
-25
@@ -27,7 +27,6 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.java.alt.AltClassFinder;
|
||||
import org.jetbrains.jet.plugin.JetFileType;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -43,7 +42,6 @@ public class PsiClassFinderForJvm implements PsiClassFinder {
|
||||
@NotNull
|
||||
private CompilerDependencies compilerDependencies;
|
||||
|
||||
private AltClassFinder altClassFinder;
|
||||
private GlobalSearchScope javaSearchScope;
|
||||
private JavaPsiFacadeKotlinHacks javaFacade;
|
||||
|
||||
@@ -59,14 +57,13 @@ public class PsiClassFinderForJvm implements PsiClassFinder {
|
||||
|
||||
@PostConstruct
|
||||
public void initialize() {
|
||||
this.altClassFinder = new AltClassFinder(project, compilerDependencies.getJdkAnnotationsRoots());
|
||||
this.javaSearchScope = new DelegatingGlobalSearchScope(GlobalSearchScope.allScope(project)) {
|
||||
javaSearchScope = new DelegatingGlobalSearchScope(GlobalSearchScope.allScope(project)) {
|
||||
@Override
|
||||
public boolean contains(VirtualFile file) {
|
||||
return myBaseScope.contains(file) && file.getFileType() != JetFileType.INSTANCE;
|
||||
}
|
||||
};
|
||||
this.javaFacade = new JavaPsiFacadeKotlinHacks(project);
|
||||
javaFacade = new JavaPsiFacadeKotlinHacks(project);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,38 +71,24 @@ public class PsiClassFinderForJvm implements PsiClassFinder {
|
||||
@Nullable
|
||||
public PsiClass findPsiClass(@NotNull FqName qualifiedName, @NotNull RuntimeClassesHandleMode runtimeClassesHandleMode) {
|
||||
PsiClass original = javaFacade.findClass(qualifiedName.getFqName(), javaSearchScope);
|
||||
PsiClass altClass = altClassFinder.findClass(qualifiedName);
|
||||
|
||||
PsiClass result = original;
|
||||
if (altClass != null) {
|
||||
if (original == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (altClass instanceof ClsClassImpl) {
|
||||
altClass.putUserData(ClsClassImpl.DELEGATE_KEY, original);
|
||||
}
|
||||
|
||||
result = altClass;
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
FqName actualQualifiedName = new FqName(result.getQualifiedName());
|
||||
if (original != null) {
|
||||
FqName actualQualifiedName = new FqName(original.getQualifiedName());
|
||||
if (!actualQualifiedName.equals(qualifiedName)) {
|
||||
throw new IllegalStateException("requested " + qualifiedName + ", got " + actualQualifiedName);
|
||||
}
|
||||
}
|
||||
|
||||
if (result instanceof JetJavaMirrorMarker) {
|
||||
if (original instanceof JetJavaMirrorMarker) {
|
||||
throw new IllegalStateException("JetJavaMirrorMaker is not possible in resolve.java, resolving: " + qualifiedName);
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
if (original == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PsiAnnotation assertInvisibleAnnotation = JavaDescriptorResolver
|
||||
.findAnnotation(result, JvmStdlibNames.ASSERT_INVISIBLE_IN_RESOLVER.getFqName().getFqName());
|
||||
.findAnnotation(original, JvmStdlibNames.ASSERT_INVISIBLE_IN_RESOLVER.getFqName().getFqName());
|
||||
if (assertInvisibleAnnotation != null) {
|
||||
if (runtimeClassesHandleMode == RuntimeClassesHandleMode.IGNORE) {
|
||||
return null;
|
||||
@@ -120,7 +103,7 @@ public class PsiClassFinderForJvm implements PsiClassFinder {
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return original;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package org.jetbrains.jet.lang.resolve.java.alt;
|
||||
|
||||
import com.intellij.core.CoreJavaFileManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO: rename
|
||||
public class AltClassFinder {
|
||||
private final PsiManager psiManager;
|
||||
private final List<VirtualFile> roots;
|
||||
|
||||
|
||||
public AltClassFinder(Project project, @NotNull List<VirtualFile> roots) {
|
||||
psiManager = PsiManager.getInstance(project);
|
||||
this.roots = roots;
|
||||
}
|
||||
|
||||
public PsiClass findClass(@NotNull FqName qualifiedName) {
|
||||
for (final VirtualFile classRoot : roots) {
|
||||
PsiClass answer = CoreJavaFileManager.findClassInClasspathRoot(qualifiedName.getFqName(), classRoot, psiManager);
|
||||
if (answer != null) return answer;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user