Search in sources :

Example 1 with HighlightVisitor

use of com.intellij.codeInsight.daemon.impl.HighlightVisitor in project intellij-community by JetBrains.

the class PsiConcurrencyStressTest method readStep.

private void readStep(final Random random) {
    PsiClass aClass = getPsiClass();
    switch(random.nextInt(4)) {
        case 0:
            mark("v");
            aClass.getContainingFile().accept(new PsiRecursiveElementVisitor() {
            });
            break;
        case 1:
            mark("m");
            for (int offset = 0; offset < myFile.getTextLength(); offset++) {
                myFile.findElementAt(offset);
            }
            break;
        case 2:
            mark("h");
            aClass.accept(new PsiRecursiveElementVisitor() {

                @Override
                public void visitElement(final PsiElement element) {
                    super.visitElement(element);
                    final HighlightInfoHolder infoHolder = new HighlightInfoHolder(myFile);
                    for (HighlightVisitor visitor : Extensions.getExtensions(HighlightVisitor.EP_HIGHLIGHT_VISITOR, getProject())) {
                        // to avoid race for com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.myAnnotationHolder
                        HighlightVisitor v = visitor.clone();
                        v.analyze(myFile, true, infoHolder, () -> v.visit(element));
                    }
                }
            });
            break;
        case 3:
            mark("u");
            for (PsiMethod method : aClass.getMethods()) {
                method.getName();
            }
            break;
    }
}
Also used : HighlightInfoHolder(com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder) HighlightVisitor(com.intellij.codeInsight.daemon.impl.HighlightVisitor)

Aggregations

HighlightVisitor (com.intellij.codeInsight.daemon.impl.HighlightVisitor)1 HighlightInfoHolder (com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder)1