本文整理了Java中org.jacoco.core.analysis.Analyzer.analyzeClass()
方法的一些代码示例,展示了Analyzer.analyzeClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Analyzer.analyzeClass()
方法的具体详情如下:
包路径:org.jacoco.core.analysis.Analyzer
类名称:Analyzer
方法名:analyzeClass
[英]Analyzes the class definition from a given input stream. The provided InputStream is not closed by this method.
[中]分析给定输入流中的类定义。此方法未关闭提供的InputStream。
代码示例来源:origin: org.jacoco/org.jacoco.core
/**
* Analyzes the class given as a ASM reader.
*
* @param reader
* reader with class definitions
*/
public void analyzeClass(final ClassReader reader) {
analyzeClass(reader.b);
}
代码示例来源:origin: org.codehaus.sonar-plugins.java/java-jacoco
/**
* Caller must guarantee that {@code classFile} is actually class file.
*/
private void analyzeClassFile(Analyzer analyzer, File classFile) {
InputStream inputStream = null;
try {
inputStream = new FileInputStream(classFile);
analyzer.analyzeClass(inputStream, classFile.getPath());
} catch (IOException e) {
// (Godin): in fact JaCoCo includes name into exception
JaCoCoExtensions.LOG.warn("Exception during analysis of file " + classFile.getAbsolutePath(), e);
} finally {
Closeables.closeQuietly(inputStream);
}
}
代码示例来源:origin: SonarSource/sonar-java
private static void analyzeClassFile(Analyzer analyzer, File classFile) {
try (InputStream inputStream = new FileInputStream(classFile)) {
analyzer.analyzeClass(inputStream, classFile.getPath());
} catch (IOException e) {
// (Godin): in fact JaCoCo includes name into exception
LOG.warn("Exception during analysis of file " + classFile.getAbsolutePath(), e);
}
}
代码示例来源:origin: stackoverflow.com
// Together with the original class definition we can calculate coverage
// information:
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executionData, coverageBuilder);
analyzer.analyzeClass(getTargetClass(targetName), targetName);
代码示例来源:origin: pmayweg/sonar-groovy
private static void analyzeClassFile(Analyzer analyzer, File classFile) {
try (InputStream inputStream = new FileInputStream(classFile)) {
analyzer.analyzeClass(inputStream, classFile.getPath());
} catch (IOException e) {
// (Godin): in fact JaCoCo includes name into exception
JaCoCoExtensions.logger().warn("Exception during analysis of file " + classFile.getAbsolutePath(), e);
}
}
代码示例来源:origin: org.jacoco/org.jacoco.core
/**
* Analyzes the class definition from a given in-memory buffer.
*
* @param buffer
* class definitions
* @param location
* a location description used for exception messages
* @throws IOException
* if the class can't be analyzed
*/
public void analyzeClass(final byte[] buffer, final String location)
throws IOException {
try {
analyzeClass(buffer);
} catch (final RuntimeException cause) {
throw analyzerError(location, cause);
}
}
代码示例来源:origin: com.android.tools.build/gradle-core
private static void analyzeAll(@NonNull Analyzer analyzer, @NonNull File file)
throws IOException {
if (file.isDirectory()) {
for (final File f : file.listFiles()) {
analyzeAll(analyzer, f);
}
} else {
String name = file.getName();
if (!name.endsWith(".class") ||
name.equals("R.class") ||
name.startsWith("R$") ||
name.equals("Manifest.class") ||
name.startsWith("Manifest$") ||
name.equals("BuildConfig.class")) {
return;
}
InputStream in = new FileInputStream(file);
try {
analyzer.analyzeClass(in, file.getAbsolutePath());
} finally {
Closeables.closeQuietly(in);
}
}
}
代码示例来源:origin: org.jacoco/org.jacoco.core
/**
* Analyzes the class definition from a given input stream. The provided
* {@link InputStream} is not closed by this method.
*
* @param input
* stream to read class definition from
* @param location
* a location description used for exception messages
* @throws IOException
* if the stream can't be read or the class can't be analyzed
*/
public void analyzeClass(final InputStream input, final String location)
throws IOException {
final byte[] buffer;
try {
buffer = InputStreams.readFully(input);
} catch (final IOException e) {
throw analyzerError(location, e);
}
analyzeClass(buffer, location);
}
代码示例来源:origin: stackoverflow.com
analyzer.analyzeClass(getTargetClass(targetName), targetName);
代码示例来源:origin: org.jacoco/org.jacoco.core
analyzeClass(detector.getInputStream(), location);
return 1;
case ContentTypeDetector.ZIPFILE:
内容来源于网络,如有侵权,请联系作者删除!