call getClasses() in read action (EA-64639 - assert: PsiFileImpl.getStubTree)

This commit is contained in:
Dmitry Jemerov
2015-02-24 15:08:54 +01:00
parent 640c53dbea
commit 0d828dab6c
@@ -1,3 +1,18 @@
/*
* 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.
* 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.
*/
package com.intellij.coverage.view;
import com.intellij.coverage.*;
@@ -235,9 +250,13 @@ public class JavaCoverageViewExtension extends CoverageViewExtension {
: PsiFile.EMPTY_ARRAY;
}
});
for (PsiFile file : childFiles) {
for (final PsiFile file : childFiles) {
if (file instanceof PsiJavaFile) {
PsiClass[] classes = ((PsiJavaFile)file).getClasses();
PsiClass[] classes = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass[]>() {
public PsiClass[] compute() {
return ((PsiJavaFile) file).getClasses();
}
});
if (classes.length > 0) {
PsiClass aClass = classes[0];
if (!(node instanceof CoverageListRootNode) && getClassCoverageInfo(aClass) == null) continue;