use of com.intellij.rt.coverage.instrumentation.SourceLineCounter in project intellij-community by JetBrains.
the class SourceLineCounterUtil method collectNonCoveredClassInfo.
public static boolean collectNonCoveredClassInfo(final PackageAnnotator.ClassCoverageInfo classCoverageInfo, final PackageAnnotator.PackageCoverageInfo packageCoverageInfo, byte[] content, final boolean excludeLines, final PsiClass psiClass) {
if (content == null)
return false;
ClassReader reader = new ClassReader(content, 0, content.length);
SourceLineCounter counter = new SourceLineCounter(null, excludeLines, null);
reader.accept(counter, 0);
classCoverageInfo.totalLineCount += counter.getNSourceLines();
packageCoverageInfo.totalLineCount += counter.getNSourceLines();
for (Object nameAndSig : counter.getMethodsWithSourceCode()) {
if (!PackageAnnotator.isGeneratedDefaultConstructor(psiClass, (String) nameAndSig)) {
classCoverageInfo.totalMethodCount++;
packageCoverageInfo.totalMethodCount++;
}
}
if (!counter.isInterface()) {
packageCoverageInfo.totalClassCount++;
}
return !counter.isInterface();
}
use of com.intellij.rt.coverage.instrumentation.SourceLineCounter in project intellij-community by JetBrains.
the class SourceLineCounterUtil method collectSrcLinesForUntouchedFiles.
public static void collectSrcLinesForUntouchedFiles(final List<Integer> uncoveredLines, byte[] content, final boolean excludeLines) {
final ClassReader reader = new ClassReader(content);
final SourceLineCounter collector = new SourceLineCounter(null, excludeLines, null);
reader.accept(collector, 0);
final TIntObjectHashMap lines = collector.getSourceLines();
lines.forEachKey(new TIntProcedure() {
public boolean execute(int line) {
line--;
uncoveredLines.add(line);
return true;
}
});
}
Aggregations