diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-10-09 23:35:41 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-10-09 23:35:41 +0200 |
commit | 7d562d641868532e5edbd6f03fac739eff9bcc90 (patch) | |
tree | 35f7ac6c07958d80561c898b9956b6830a071a66 /sonar-colorizer | |
parent | 39934181c5a5eba68665ea8922ff9a28322d0c0a (diff) | |
download | sonarqube-7d562d641868532e5edbd6f03fac739eff9bcc90.tar.gz sonarqube-7d562d641868532e5edbd6f03fac739eff9bcc90.zip |
Fix quality flaws
Diffstat (limited to 'sonar-colorizer')
3 files changed, 13 insertions, 3 deletions
diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/CodeColorizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/CodeColorizer.java index bf1fe61df74..4c8695843c3 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/CodeColorizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/CodeColorizer.java @@ -19,6 +19,8 @@ */ package org.sonar.colorizer; +import javax.annotation.Nullable; + import java.io.Reader; import java.util.List; @@ -38,7 +40,7 @@ public class CodeColorizer { return toHtml(code, null); } - public String toHtml(Reader code, HtmlOptions options) { + public String toHtml(Reader code, @Nullable HtmlOptions options) { HtmlOptions opts = options == null ? HtmlOptions.DEFAULT : options; return new HtmlRenderer(opts).render(code, tokenizers); } diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java index e6755e7b7e7..c7f9f3d3a7e 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java @@ -19,6 +19,9 @@ */ package org.sonar.colorizer; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + import java.util.HashMap; import java.util.Map; @@ -75,13 +78,14 @@ public class HtmlCodeBuilder implements Appendable { * @param value * can be null */ - public void setVariable(Object key, Object value) { + public void setVariable(Object key, @Nullable Object value) { variables.put(key, value); } /** * Get a stateful variable. Return null if not found. */ + @CheckForNull public Object getVariable(Object key) { return variables.get(key); } diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlOptions.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlOptions.java index d91d89bf5e7..da86bc689c0 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlOptions.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlOptions.java @@ -19,6 +19,9 @@ */ package org.sonar.colorizer; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + public class HtmlOptions { public static final HtmlOptions DEFAULT = new HtmlOptions(true, null, true); public static final OnlySyntaxHtmlOptions ONLY_SYNTAX = new OnlySyntaxHtmlOptions(); @@ -31,7 +34,7 @@ public class HtmlOptions { public HtmlOptions() { } - public HtmlOptions(boolean generateTable, String tableId, boolean generateHtmlHeader) { + public HtmlOptions(boolean generateTable, @Nullable String tableId, boolean generateHtmlHeader) { this.generateTable = generateTable; this.generateHtmlHeader = generateHtmlHeader; this.tableId = tableId; @@ -61,6 +64,7 @@ public class HtmlOptions { return this; } + @CheckForNull public String getTableId() { return tableId; } |