mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
IDEA-91309: All classes in the same package are marked as unresolved
This commit is contained in:
@@ -18,6 +18,7 @@ package com.intellij.core;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.roots.FileIndexFacade;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.compiled.ClsFileImpl;
|
||||
@@ -44,7 +45,9 @@ public class CoreJavaDirectoryService extends JavaDirectoryService {
|
||||
public PsiClass[] getClasses(@NotNull PsiDirectory dir) {
|
||||
LOG.assertTrue(dir.isValid());
|
||||
|
||||
boolean onlyCompiled = FileIndexFacade.getInstance(dir.getProject()).isInLibraryClasses(dir.getVirtualFile());
|
||||
FileIndexFacade index = FileIndexFacade.getInstance(dir.getProject());
|
||||
VirtualFile virtualDir = dir.getVirtualFile();
|
||||
boolean onlyCompiled = index.isInLibraryClasses(virtualDir) && !index.isInSourceContent(virtualDir);
|
||||
|
||||
List<PsiClass> classes = null;
|
||||
for (PsiFile file : dir.getFiles()) {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
public class ModuleSourceAsLibraryClasses {
|
||||
<ref>ModuleSourceAsLibraryClassesDep field;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
public class ModuleSourceAsLibraryClassesDep {}
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packageDependencies.DependenciesBuilder;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
@@ -181,6 +182,23 @@ public class ResolveClassTest extends ResolveTestCase {
|
||||
assertInstanceOf(ref.resolve(), PsiClass.class);
|
||||
}
|
||||
|
||||
public void testModuleSourceAsLibraryClasses() throws Exception {
|
||||
final PsiReference ref = configure();
|
||||
PsiFile psiFile = ref.getElement().getContainingFile();
|
||||
final VirtualFile file = psiFile.getVirtualFile();
|
||||
assertNotNull(file);
|
||||
createFile(myModule, file.getParent(), "ModuleSourceAsLibraryClassesDep.java", loadFile("class/ModuleSourceAsLibraryClassesDep.java"));
|
||||
ModuleRootModificationUtil.addModuleLibrary(myModule, "lib", Collections.singletonList(file.getParent().getUrl()), Collections.<String>emptyList());
|
||||
//need this to ensure that PsiJavaFileBaseImpl.myResolveCache is filled to reproduce IDEA-91309
|
||||
DependenciesBuilder.analyzeFileDependencies(psiFile, new DependenciesBuilder.DependencyProcessor() {
|
||||
@Override
|
||||
public void process(PsiElement place, PsiElement dependency) {
|
||||
}
|
||||
});
|
||||
assertInstanceOf(ref.resolve(), PsiClass.class);
|
||||
}
|
||||
|
||||
|
||||
public void testStaticImportInTheSameClass() throws Exception {
|
||||
PsiReference ref = configure();
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
Reference in New Issue
Block a user