Search in sources :

Example 16 with JavaVersionImpl

use of org.sonar.java.model.JavaVersionImpl 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

JavaVersionImpl (org.sonar.java.model.JavaVersionImpl)16 File (java.io.File)8 Test (org.junit.Test)5 TestInputFileBuilder (org.sonar.api.batch.fs.internal.TestInputFileBuilder)5 InputFile (org.sonar.api.batch.fs.InputFile)4 JavaResourceLocator (org.sonar.plugins.java.api.JavaResourceLocator)4 NoSonarFilter (org.sonar.api.issue.NoSonarFilter)3 JavaSquid (org.sonar.java.JavaSquid)3 FileSystem (org.sonar.api.batch.fs.FileSystem)2 DefaultFileSystem (org.sonar.api.batch.fs.internal.DefaultFileSystem)2 DefaultInputFile (org.sonar.api.batch.fs.internal.DefaultInputFile)2 CheckFactory (org.sonar.api.batch.rule.CheckFactory)2 SensorContextTester (org.sonar.api.batch.sensor.internal.SensorContextTester)2 FileLinesContext (org.sonar.api.measures.FileLinesContext)2 FileLinesContextFactory (org.sonar.api.measures.FileLinesContextFactory)2 Serializable (java.io.Serializable)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Server (org.sonar.api.platform.Server)1 SonarComponents (org.sonar.java.SonarComponents)1