Class JavaFileScannerContextForTests
java.lang.Object
org.sonar.java.model.DefaultModuleScannerContext
org.sonar.java.model.DefaultInputFileScannerContext
org.sonar.java.model.DefaultJavaFileScannerContext
org.sonar.java.testing.JavaFileScannerContextForTests
- All Implemented Interfaces:
MetricsScannerContext
,RegexScannerContext
,FluentReporting
,InputFileScannerContext
,JavaFileScannerContext
,ModuleScannerContext
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.sonar.java.reporting.FluentReporting
FluentReporting.JavaIssueBuilder
Nested classes/interfaces inherited from interface org.sonar.plugins.java.api.JavaFileScannerContext
JavaFileScannerContext.Location
-
Field Summary
Fields inherited from class org.sonar.java.model.DefaultInputFileScannerContext
inputFile
Fields inherited from class org.sonar.java.model.DefaultModuleScannerContext
cacheContext, inAndroidContext, javaVersion, sonarComponents
-
Constructor Summary
ConstructorsConstructorDescriptionJavaFileScannerContextForTests
(CompilationUnitTree tree, org.sonar.api.batch.fs.InputFile inputFile, Sema semanticModel, SonarComponents sonarComponents, JavaVersion javaVersion, boolean failedParsing, boolean inAndroidContext, CacheContext cacheContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Report an issue on a specific line.void
addIssueOnProject
(JavaCheck javaCheck, String message) Report an issue at the project level.createAnalyzerMessage
(JavaCheck javaCheck, Tree startTree, String message) newIssue()
void
reportIssue
(AnalyzerMessage message) void
reportIssue
(JavaCheck javaCheck, Tree tree, String message) Report an issue.void
reportIssue
(JavaCheck javaCheck, Tree syntaxNode, String message, List<JavaFileScannerContext.Location> secondary, Integer cost) Report an issue.void
reportIssue
(JavaCheck javaCheck, Tree startTree, Tree endTree, String message) Report an issue.void
reportIssue
(JavaCheck javaCheck, Tree startTree, Tree endTree, String message, List<JavaFileScannerContext.Location> secondary, Integer cost) Report an issue.void
reportIssueWithFlow
(JavaCheck javaCheck, Tree syntaxNode, String message, Iterable<List<JavaFileScannerContext.Location>> flows, Integer cost) Report an issue.Methods inherited from class org.sonar.java.model.DefaultJavaFileScannerContext
createAnalyzerMessage, fileParsed, getComplexityNodes, getFileContent, getFileLines, getMetricsComputer, getSemanticModel, getTree, regexForLiterals, reportIssue, reportIssue, sourceMap, throwIfEndOfAnalysisCheck
Methods inherited from class org.sonar.java.model.DefaultInputFileScannerContext
addIssue, addIssueOnFile, getInputFile
Methods inherited from class org.sonar.java.model.DefaultModuleScannerContext
getCacheContext, getJavaVersion, getModuleKey, getProject, getRootProjectWorkingDirectory, getWorkingDirectory, inAndroidContext, sonarProduct
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.sonar.plugins.java.api.InputFileScannerContext
addIssue, addIssueOnFile, getInputFile
Methods inherited from interface org.sonar.plugins.java.api.ModuleScannerContext
getCacheContext, getJavaVersion, getModuleKey, getProject, getRootProjectWorkingDirectory, getWorkingDirectory, inAndroidContext, sonarProduct
-
Constructor Details
-
JavaFileScannerContextForTests
public JavaFileScannerContextForTests(CompilationUnitTree tree, org.sonar.api.batch.fs.InputFile inputFile, Sema semanticModel, @Nullable SonarComponents sonarComponents, JavaVersion javaVersion, boolean failedParsing, boolean inAndroidContext, @Nullable CacheContext cacheContext)
-
-
Method Details
-
getIssues
-
getQuickFixes
-
addIssueOnProject
Description copied from interface:ModuleScannerContext
Report an issue at the project level.- Specified by:
addIssueOnProject
in interfaceModuleScannerContext
- Overrides:
addIssueOnProject
in classDefaultModuleScannerContext
- Parameters:
javaCheck
- The check raising the issue.message
- Message to display to the user
-
addIssue
Description copied from interface:InputFileScannerContext
Report an issue on a specific line. PreferJavaFileScannerContext.reportIssue(JavaCheck, Tree, String, List, Integer)
for more precise reporting.- Specified by:
addIssue
in interfaceInputFileScannerContext
- Overrides:
addIssue
in classDefaultInputFileScannerContext
- Parameters:
line
- line on which to report the issuejavaCheck
- The check raising the issue.message
- Message to display to the usercost
- computed remediation cost if applicable, null if not.
-
reportIssue
Description copied from interface:JavaFileScannerContext
Report an issue.- Specified by:
reportIssue
in interfaceJavaFileScannerContext
- Overrides:
reportIssue
in classDefaultJavaFileScannerContext
- Parameters:
javaCheck
- check raising the issuetree
- syntax node on which to raise the issue.message
- Message to display to the user.
-
reportIssue
public void reportIssue(JavaCheck javaCheck, Tree syntaxNode, String message, List<JavaFileScannerContext.Location> secondary, @Nullable Integer cost) Description copied from interface:JavaFileScannerContext
Report an issue.- Specified by:
reportIssue
in interfaceJavaFileScannerContext
- Overrides:
reportIssue
in classDefaultJavaFileScannerContext
- Parameters:
javaCheck
- check raising the issuesyntaxNode
- syntax node on which to raise the issue.message
- Message to display to the user.secondary
- List ofJavaFileScannerContext.Location
to display secondary location for the issue.cost
- computed remediation cost if applicable, null if not.
-
reportIssue
Description copied from interface:JavaFileScannerContext
Report an issue.- Specified by:
reportIssue
in interfaceJavaFileScannerContext
- Overrides:
reportIssue
in classDefaultJavaFileScannerContext
- Parameters:
javaCheck
- check raising the issuestartTree
- syntax node on which to start the highlighting of the issue.endTree
- syntax node on which to end the highlighting of the issue.message
- Message to display to the user.
-
reportIssue
public void reportIssue(JavaCheck javaCheck, Tree startTree, Tree endTree, String message, List<JavaFileScannerContext.Location> secondary, @Nullable Integer cost) Description copied from interface:JavaFileScannerContext
Report an issue.- Specified by:
reportIssue
in interfaceJavaFileScannerContext
- Overrides:
reportIssue
in classDefaultJavaFileScannerContext
- Parameters:
javaCheck
- check raising the issuestartTree
- syntax node on which to start the highlighting of the issue.endTree
- syntax node on which to end the highlighting of the issue.message
- Message to display to the user.secondary
- List ofJavaFileScannerContext.Location
to display secondary location for the issue.cost
- computed remediation cost if applicable, null if not.
-
reportIssueWithFlow
public void reportIssueWithFlow(JavaCheck javaCheck, Tree syntaxNode, String message, Iterable<List<JavaFileScannerContext.Location>> flows, @Nullable Integer cost) Description copied from interface:JavaFileScannerContext
Report an issue.- Specified by:
reportIssueWithFlow
in interfaceJavaFileScannerContext
- Overrides:
reportIssueWithFlow
in classDefaultJavaFileScannerContext
- Parameters:
javaCheck
- check raising the issuesyntaxNode
- syntax node on which to raise the issue.message
- Message to display to the user.flows
- List of list ofJavaFileScannerContext.Location
to display flows for the issue.cost
- computed remediation cost if applicable, null if not.
-
reportIssue
- Overrides:
reportIssue
in classDefaultModuleScannerContext
-
createAnalyzerMessage
- Overrides:
createAnalyzerMessage
in classDefaultJavaFileScannerContext
-
newIssue
- Specified by:
newIssue
in interfaceFluentReporting
- Overrides:
newIssue
in classDefaultJavaFileScannerContext
-