Search in sources :

Example 1 with FileCodeLoaderWithoutCache

use of org.sonar.duplications.cpd.FileCodeLoaderWithoutCache in project sonarqube by SonarSource.

the class TokenizerBridge method chunk.

public List<TokensLine> chunk(File file) {
    SourceCode sourceCode = new SourceCode(new FileCodeLoaderWithoutCache(file, encoding));
    Tokens tokens = new Tokens();
    TokenEntry.clearImages();
    try {
        tokenizer.tokenize(sourceCode, tokens);
    } catch (IOException e) {
        throw Throwables.propagate(e);
    }
    TokenEntry.clearImages();
    return convert(tokens.getTokens());
}
Also used : SourceCode(net.sourceforge.pmd.cpd.SourceCode) FileCodeLoaderWithoutCache(org.sonar.duplications.cpd.FileCodeLoaderWithoutCache) IOException(java.io.IOException) Tokens(net.sourceforge.pmd.cpd.Tokens)

Aggregations

IOException (java.io.IOException)1 SourceCode (net.sourceforge.pmd.cpd.SourceCode)1 Tokens (net.sourceforge.pmd.cpd.Tokens)1 FileCodeLoaderWithoutCache (org.sonar.duplications.cpd.FileCodeLoaderWithoutCache)1