Search in sources :

Example 1 with DefaultJavaFileScannerContext

use of org.sonar.java.model.DefaultJavaFileScannerContext in project sonar-java by SonarSource.

the class SETestUtils method createSymbolicExecutionVisitorAndSemantic.

public static Pair<SymbolicExecutionVisitor, SemanticModel> createSymbolicExecutionVisitorAndSemantic(String fileName, boolean crossFileEnabled, SECheck... checks) {
    File file = new File(fileName);
    CompilationUnitTree cut = (CompilationUnitTree) PARSER.parse(file);
    SemanticModel semanticModel = SemanticModel.createFor(cut, CLASSLOADER);
    SymbolicExecutionVisitor sev = new SymbolicExecutionVisitor(Arrays.asList(checks), new BehaviorCache(CLASSLOADER, crossFileEnabled));
    sev.scanFile(new DefaultJavaFileScannerContext(cut, file, semanticModel, null, new JavaVersionImpl(8), true));
    return new Pair<>(sev, semanticModel);
}
Also used : CompilationUnitTree(org.sonar.plugins.java.api.tree.CompilationUnitTree) JavaVersionImpl(org.sonar.java.model.JavaVersionImpl) DefaultJavaFileScannerContext(org.sonar.java.model.DefaultJavaFileScannerContext) SemanticModel(org.sonar.java.resolve.SemanticModel) BehaviorCache(org.sonar.java.se.xproc.BehaviorCache) File(java.io.File)

Aggregations

File (java.io.File)1 DefaultJavaFileScannerContext (org.sonar.java.model.DefaultJavaFileScannerContext)1 JavaVersionImpl (org.sonar.java.model.JavaVersionImpl)1 SemanticModel (org.sonar.java.resolve.SemanticModel)1 BehaviorCache (org.sonar.java.se.xproc.BehaviorCache)1 CompilationUnitTree (org.sonar.plugins.java.api.tree.CompilationUnitTree)1