Search in sources :

Example 96 with PsiClass

use of com.intellij.psi.PsiClass in project kotlin by JetBrains.

the class LightClassEqualsTest method testEqualsForExplicitDeclaration.

public void testEqualsForExplicitDeclaration() throws Exception {
    myFixture.configureByText("a.kt", "class A");
    PsiClass theClass = myFixture.getJavaFacade().findClass("A");
    assertNotNull(theClass);
    assertInstanceOf(theClass, KtLightClassForSourceDeclaration.class);
    doTestEquals(((KtLightClass) theClass).getKotlinOrigin());
}
Also used : PsiClass(com.intellij.psi.PsiClass)

Example 97 with PsiClass

use of com.intellij.psi.PsiClass in project kotlin by JetBrains.

the class AbstractSearcherTest method getPsiClass.

protected PsiClass getPsiClass(String className) {
    PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(className, getGlobalScope());
    assertNotNull("Couldn't find a psiClass: " + className, psiClass);
    return psiClass;
}
Also used : PsiClass(com.intellij.psi.PsiClass)

Example 98 with PsiClass

use of com.intellij.psi.PsiClass in project kotlin by JetBrains.

the class AbstractSearcherTest method checkResult.

protected void checkResult(Query<?> actual) throws IOException {
    String text = FileUtil.loadFile(new File(getPathToFile()), true);
    List<String> classFqnFilters = InTextDirectivesUtils.findListWithPrefixes(text, "// IGNORE_CLASSES: ");
    List<String> actualModified = new ArrayList<String>();
    for (Object member : actual) {
        if (member instanceof PsiClass) {
            final String qualifiedName = ((PsiClass) member).getQualifiedName();
            assert qualifiedName != null;
            boolean filterOut = CollectionsKt.any(classFqnFilters, new Function1<String, Boolean>() {

                @Override
                public Boolean invoke(String s) {
                    return qualifiedName.startsWith(s);
                }
            });
            if (filterOut) {
                continue;
            }
        }
        actualModified.add(stringRepresentation(member));
    }
    Collections.sort(actualModified);
    List<String> expected = InTextDirectivesUtils.findListWithPrefixes(text, "// SEARCH: ");
    Collections.sort(expected);
    assertOrderedEquals(actualModified, expected);
}
Also used : ArrayList(java.util.ArrayList) PsiClass(com.intellij.psi.PsiClass) File(java.io.File)

Example 99 with PsiClass

use of com.intellij.psi.PsiClass in project kotlin by JetBrains.

the class JUnitMembersSearcherTest method doJUnit4test.

private void doJUnit4test() throws IOException {
    myFixture.configureByFile(getFileName());
    List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true), "// ANNOTATION: ");
    assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty());
    String annotationClassName = directives.get(0);
    PsiClass psiClass = getPsiClass(annotationClassName);
    checkResult(AnnotatedMembersSearch.search(psiClass, getProjectScope()));
}
Also used : PsiClass(com.intellij.psi.PsiClass) File(java.io.File)

Example 100 with PsiClass

use of com.intellij.psi.PsiClass in project kotlin by JetBrains.

the class JUnitMembersSearcherTest method doJUnit3test.

private void doJUnit3test() throws IOException {
    myFixture.configureByFile(getFileName());
    List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true), "// CLASS: ");
    assertFalse("Specify CLASS directive in test file", directives.isEmpty());
    String superClassName = directives.get(0);
    PsiClass psiClass = getPsiClass(superClassName);
    checkResult(ClassInheritorsSearch.search(psiClass, getProjectScope(), false));
}
Also used : PsiClass(com.intellij.psi.PsiClass) File(java.io.File)

Aggregations

PsiClass (com.intellij.psi.PsiClass)594 PsiElement (com.intellij.psi.PsiElement)113 PsiMethod (com.intellij.psi.PsiMethod)97 Nullable (org.jetbrains.annotations.Nullable)75 NotNull (org.jetbrains.annotations.NotNull)60 Project (com.intellij.openapi.project.Project)59 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)57 Module (com.intellij.openapi.module.Module)55 PsiFile (com.intellij.psi.PsiFile)49 VirtualFile (com.intellij.openapi.vfs.VirtualFile)47 ArrayList (java.util.ArrayList)37 PsiField (com.intellij.psi.PsiField)36 JavaPsiFacade (com.intellij.psi.JavaPsiFacade)25 Location (com.intellij.execution.Location)20 File (java.io.File)16 HashSet (java.util.HashSet)16 PsiClassType (com.intellij.psi.PsiClassType)15 PsiPackage (com.intellij.psi.PsiPackage)15 List (java.util.List)15 PsiType (com.intellij.psi.PsiType)13