diff --git a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveInLibrariesTest.groovy b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveInLibrariesTest.groovy index 82780383856c..ce5c6575fb86 100644 --- a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveInLibrariesTest.groovy +++ b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveInLibrariesTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -30,6 +30,7 @@ import com.intellij.psi.search.searches.OverridingMethodsSearch import com.intellij.psi.stubs.StubTreeLoader import com.intellij.testFramework.PsiTestUtil import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase + /** * @author peter */ @@ -56,7 +57,6 @@ class ResolveInLibrariesTest extends JavaCodeInsightFixtureTestCase { def file1 = parsers[1].navigationElement.containingFile assert file1.virtualFile.path.startsWith(srcCopy.path) assert file1.findReferenceAt(file1.text.indexOf('IXMLReader reader')).resolve().navigationElement.containingFile.virtualFile.path.startsWith(srcCopy.path) - } public void "test inheritance transitivity"() { @@ -76,20 +76,19 @@ class ResolveInLibrariesTest extends JavaCodeInsightFixtureTestCase { def middles = JavaPsiFacade.getInstance(project).findClasses('com.google.protobuf.AbstractMessageLite', scope) assert middles.size() == 2 - def intfs = JavaPsiFacade.getInstance(project).findClasses('com.google.protobuf.MessageLite', scope) - assert intfs.size() == 2 + def interfaces = JavaPsiFacade.getInstance(project).findClasses('com.google.protobuf.MessageLite', scope) + assert interfaces.size() == 2 for (i in 0..1) { - assert ClassInheritorsSearch.search(intfs[i]).findAll().containsAll([middles[i], bottoms[i]]) - intfs[i].methods.each { + assert ClassInheritorsSearch.search(interfaces[i]).findAll().containsAll([middles[i], bottoms[i]]) + interfaces[i].methods.each { assert OverridingMethodsSearch.search(it).findAll() } - assert middles[i].isInheritor(intfs[i], true) - assert bottoms[i].isInheritor(intfs[i], true) + assert middles[i].isInheritor(interfaces[i], true) + assert bottoms[i].isInheritor(interfaces[i], true) assert bottoms[i].isInheritor(middles[i], true) } - } public void "test accept that with different library versions inheritance relation may be intransitive"() { @@ -103,6 +102,7 @@ class ResolveInLibrariesTest extends JavaCodeInsightFixtureTestCase { def scope = GlobalSearchScope.allScope(project) + //noinspection SpellCheckingInspection def i0 = JavaPsiFacade.getInstance(project).findClass('Intf', scope) def other0 = JavaPsiFacade.getInstance(project).findClass('Other', scope) def b1 = JavaPsiFacade.getInstance(project).findClass('Bottom', scope) @@ -191,9 +191,8 @@ class ResolveInLibrariesTest extends JavaCodeInsightFixtureTestCase { } private void checkFileIsNotLoadedAndHasNoIndexedStub(VirtualFile vfile) { - PsiFileImpl file = psiManager.findFile(vfile); + PsiFileImpl file = psiManager.findFile(vfile) as PsiFileImpl; assert file != null - assert !file.contentsLoaded assert !StubTreeLoader.instance.readFromVFile(project, vfile) assert !StubTreeLoader.instance.canHaveStub(vfile) @@ -209,7 +208,7 @@ class ResolveInLibrariesTest extends JavaCodeInsightFixtureTestCase { PsiTestUtil.addLibrary(myModule, "lib1", myFixture.tempDirFixture.getFile("").path, "lib1"); myFixture.configureFromExistingVirtualFile(myFixture.addFileToProject("TestCase.java", """ -class Testcase { +class TestCase { public static void main( String[] args ) { new B().a(); // 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 @@ -224,9 +223,9 @@ class Testcase { myFixture.copyDirectoryToProject("", "lib") PsiTestUtil.addLibrary(myModule, "lib", myFixture.tempDirFixture.getFile("").path, "lib"); - def message = JavaPsiFacade.getInstance(project).findClass('com.google.protobuf.AbstractMessageLite', - GlobalSearchScope.allScope(project)) + def message = JavaPsiFacade.getInstance(project).findClass('com.google.protobuf.AbstractMessageLite', GlobalSearchScope.allScope(project)) assert message + def method = message.findMethodsByName("toByteArray", false)[0] assert method assert method.hierarchicalMethodSignature.superSignatures.size() == 1