/** * Analyzes the class given as a ASM reader. * * @param reader * reader with class definitions */ public void analyzeClass(final ClassReader reader) { analyzeClass(reader.b); }
/** * 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); } }
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); } }
// 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);
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); } }
/** * 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); } }
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); } } }
/** * 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); }
analyzer.analyzeClass(getTargetClass(targetName), targetName);
analyzeClass(detector.getInputStream(), location); return 1; case ContentTypeDetector.ZIPFILE: