mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
findClass should correctly sort compiled classes located inside project content (IDEA-101806)
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -160,7 +160,7 @@ class ResolveInLibrariesTest extends JavaCodeInsightFixtureTestCase {
|
||||
|
||||
@Override
|
||||
protected boolean toAddSourceRoot() {
|
||||
return false;
|
||||
return name != "test do not build stubs in source jars";
|
||||
}
|
||||
|
||||
public void "test do not build stubs in source jars"() {
|
||||
@@ -197,4 +197,24 @@ class ResolveInLibrariesTest extends JavaCodeInsightFixtureTestCase {
|
||||
assert !StubTreeLoader.instance.canHaveStub(vfile)
|
||||
assert file.stub // from text
|
||||
}
|
||||
|
||||
public void "test directory with class files inside project content"() {
|
||||
def testData = PathManagerEx.getTestDataPath() + "/codeInsight/interJarDependencies"
|
||||
myFixture.setTestDataPath(testData)
|
||||
PsiTestUtil.addLibrary(myModule, "lib2", testData, "lib2.jar");
|
||||
|
||||
myFixture.copyDirectoryToProject("lib1", "lib1")
|
||||
PsiTestUtil.addLibrary(myModule, "lib1", myFixture.tempDirFixture.getFile("").path, "lib1");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myFixture.addFileToProject("TestCase.java", """
|
||||
class Testcase {
|
||||
public static void main( String[] args ) {
|
||||
new B().<error descr="Cannot resolve method 'a()'">a</error>(); // should not work, because the A in lib1 has no method a
|
||||
new B().a2(); // should work, because the A with this method is in lib1
|
||||
}
|
||||
}
|
||||
""").virtualFile)
|
||||
myFixture.checkHighlighting()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-4
@@ -176,10 +176,8 @@ public class ModuleWithDependenciesScope extends GlobalSearchScope {
|
||||
|
||||
@Nullable
|
||||
private VirtualFile getFileRoot(@NotNull VirtualFile file) {
|
||||
if (myProjectFileIndex.isInContent(file)) {
|
||||
return myProjectFileIndex.getSourceRootForFile(file);
|
||||
}
|
||||
return myProjectFileIndex.getClassRootForFile(file);
|
||||
VirtualFile root = myProjectFileIndex.getClassRootForFile(file);
|
||||
return root != null ? root : myProjectFileIndex.getSourceRootForFile(file);
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
|
||||
Reference in New Issue
Block a user