Search in sources :

Example 1 with StubUnit

use of com.github.javaparser.ast.StubUnit in project checker-framework by typetools.

the class ToIndexFileConverter method convert.

/**
 * Augment given scene with information from stubfile, reading stubs from input stream and
 * writing JAIF to output stream.
 *
 * @param scene the initial scene
 * @param in stubfile contents
 * @param out JAIF representing augmented scene
 * @throws ParseException
 * @throws DefException
 */
private static void convert(AScene scene, InputStream in, OutputStream out) throws IOException, DefException, ParseException {
    StubUnit iu;
    try {
        iu = JavaParser.parseStubUnit(in);
    } catch (ParseProblemException e) {
        iu = null;
        ErrorReporter.errorAbort("ToIndexFileConverter: exception from JavaParser.parseStubUnit for InputStream." + System.lineSeparator() + "Problem message with problems encountered: " + e.getMessage());
    }
    extractScene(iu, scene);
    try (Writer w = new BufferedWriter(new OutputStreamWriter(out))) {
        IndexFileWriter.write(scene, w);
    }
}
Also used : StubUnit(com.github.javaparser.ast.StubUnit) OutputStreamWriter(java.io.OutputStreamWriter) Writer(java.io.Writer) IndexFileWriter(scenelib.annotations.io.IndexFileWriter) OutputStreamWriter(java.io.OutputStreamWriter) BufferedWriter(java.io.BufferedWriter) ParseProblemException(com.github.javaparser.ParseProblemException) BufferedWriter(java.io.BufferedWriter)

Aggregations

ParseProblemException (com.github.javaparser.ParseProblemException)1 StubUnit (com.github.javaparser.ast.StubUnit)1 BufferedWriter (java.io.BufferedWriter)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 IndexFileWriter (scenelib.annotations.io.IndexFileWriter)1