aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorGabor Liptak <gliptak@gmail.com>2015-06-17 13:45:37 -0400
committerGabor Liptak <gliptak@gmail.com>2015-06-17 13:45:37 -0400
commit6f7dcf0f6ad046940c37a14041e2ddd02c457776 (patch)
tree9022c22c58ff90949dc098b5866590ee56fbbdcb /sonar-plugin-api/src
parent8714a329c98b2610cf54632400e33447b7bf7448 (diff)
downloadsonarqube-6f7dcf0f6ad046940c37a14041e2ddd02c457776.tar.gz
sonarqube-6f7dcf0f6ad046940c37a14041e2ddd02c457776.zip
Cleanup warnings
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java52
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java32
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java10
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java4
5 files changed, 52 insertions, 48 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java
index e798ce64fde..f6cccb2f2e7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java
@@ -136,7 +136,7 @@ public class DefaultMeasure<G extends Serializable> extends DefaultStorable impl
if (obj.getClass() != getClass()) {
return false;
}
- DefaultMeasure rhs = (DefaultMeasure) obj;
+ DefaultMeasure<?> rhs = (DefaultMeasure<?>) obj;
return new EqualsBuilder()
.append(file, rhs.file)
.append(metric, rhs.metric)
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
index 3d535d401b4..1f3c4aa4240 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
@@ -170,7 +170,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param mode the mode
* @return the measure object instance
*/
- public Measure setPersistenceMode(@Nullable PersistenceMode mode) {
+ public Measure<G> setPersistenceMode(@Nullable PersistenceMode mode) {
if (mode == null) {
this.persistenceMode = PersistenceMode.FULL;
} else {
@@ -182,7 +182,7 @@ public class Measure<G extends Serializable> implements Serializable {
/**
* @return return the measures underlying metric
*/
- public Metric getMetric() {
+ public Metric<G> getMetric() {
return metric;
}
@@ -196,7 +196,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param metric the metric
* @return the measure object instance
*/
- public Measure setMetric(Metric metric) {
+ public Measure<G> setMetric(Metric<G> metric) {
this.metric = metric;
this.metricKey = metric.getKey();
return this;
@@ -229,7 +229,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param date the date
* @return the measure object instance
*/
- public Measure setDate(Date date) {
+ public Measure<G> setDate(Date date) {
this.date = date;
return this;
}
@@ -289,14 +289,14 @@ public class Measure<G extends Serializable> implements Serializable {
* @param v the measure value
* @return the measure object instance
*/
- public Measure setValue(@Nullable Double v) {
+ public Measure<G> setValue(@Nullable Double v) {
return setValue(v, DEFAULT_PRECISION);
}
/**
* For internal use
*/
- public Measure setRawValue(@Nullable Double v) {
+ public Measure<G> setRawValue(@Nullable Double v) {
this.value = v;
return this;
}
@@ -307,7 +307,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param i the value
* @return the measure object instance
*/
- public Measure setIntValue(Integer i) {
+ public Measure<G> setIntValue(Integer i) {
if (i == null) {
this.value = null;
} else {
@@ -323,7 +323,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param precision the measure value precision
* @return the measure object instance
*/
- public Measure setValue(@Nullable Double v, int precision) {
+ public Measure<G> setValue(@Nullable Double v, int precision) {
if (v != null) {
if (Double.isNaN(v)) {
throw new IllegalArgumentException("Measure value can not be NaN");
@@ -354,7 +354,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param s the data
* @return the measure object instance
*/
- public Measure setData(String s) {
+ public Measure<G> setData(String s) {
this.data = s;
return this;
}
@@ -365,7 +365,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param level the alert level
* @return the measure object instance
*/
- public Measure setData(Metric.Level level) {
+ public Measure<G> setData(Metric.Level level) {
if (level == null) {
this.data = null;
} else {
@@ -377,7 +377,7 @@ public class Measure<G extends Serializable> implements Serializable {
/**
* @since 2.7
*/
- public Measure unsetData() {
+ public Measure<G> unsetData() {
this.data = null;
return this;
}
@@ -395,7 +395,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param description the description
* @return the measure object instance
*/
- public Measure setDescription(String description) {
+ public Measure<G> setDescription(String description) {
this.description = description;
return this;
}
@@ -413,7 +413,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param status the status
* @return the measure object instance
*/
- public Measure setAlertStatus(@Nullable Metric.Level status) {
+ public Measure<G> setAlertStatus(@Nullable Metric.Level status) {
this.alertStatus = status;
return this;
}
@@ -431,7 +431,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param alertText the text
* @return the measure object instance
*/
- public Measure setAlertText(@Nullable String alertText) {
+ public Measure<G> setAlertText(@Nullable String alertText) {
this.alertText = alertText;
return this;
}
@@ -453,7 +453,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @return the measure object instance
*/
@Deprecated
- public Measure setTendency(@Nullable Integer tendency) {
+ public Measure<G> setTendency(@Nullable Integer tendency) {
return this;
}
@@ -462,7 +462,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @deprecated since 4.4 not used
*/
@Deprecated
- public Measure setId(Long id) {
+ public Measure<G> setId(Long id) {
return this;
}
@@ -479,7 +479,7 @@ public class Measure<G extends Serializable> implements Serializable {
*
* @since 2.5
*/
- public Measure setVariation1(@Nullable Double d) {
+ public Measure<G> setVariation1(@Nullable Double d) {
this.variation1 = d;
return this;
}
@@ -497,7 +497,7 @@ public class Measure<G extends Serializable> implements Serializable {
*
* @since 2.5
*/
- public Measure setVariation2(@Nullable Double d) {
+ public Measure<G> setVariation2(@Nullable Double d) {
this.variation2 = d;
return this;
}
@@ -515,7 +515,7 @@ public class Measure<G extends Serializable> implements Serializable {
*
* @since 2.5
*/
- public Measure setVariation3(@Nullable Double d) {
+ public Measure<G> setVariation3(@Nullable Double d) {
this.variation3 = d;
return this;
}
@@ -533,7 +533,7 @@ public class Measure<G extends Serializable> implements Serializable {
*
* @since 2.5
*/
- public Measure setVariation4(@Nullable Double d) {
+ public Measure<G> setVariation4(@Nullable Double d) {
this.variation4 = d;
return this;
}
@@ -551,7 +551,7 @@ public class Measure<G extends Serializable> implements Serializable {
*
* @since 2.5
*/
- public Measure setVariation5(@Nullable Double d) {
+ public Measure<G> setVariation5(@Nullable Double d) {
this.variation5 = d;
return this;
}
@@ -581,7 +581,7 @@ public class Measure<G extends Serializable> implements Serializable {
*
* @since 2.5
*/
- public Measure setVariation(int index, Double d) {
+ public Measure<G> setVariation(int index, Double d) {
switch (index) {
case 1:
variation1 = d;
@@ -617,7 +617,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @param url the url
* @return the measure object instance
*/
- public Measure setUrl(String url) {
+ public Measure<G> setUrl(String url) {
this.url = url;
return this;
}
@@ -633,7 +633,7 @@ public class Measure<G extends Serializable> implements Serializable {
/**
* @since 4.1
*/
- public final Measure setCharacteristic(@Nullable Characteristic characteristic) {
+ public final Measure<G> setCharacteristic(@Nullable Characteristic characteristic) {
this.characteristic = characteristic;
return this;
}
@@ -653,7 +653,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @deprecated since 4.3
*/
@Deprecated
- public final Measure setRequirement(@Nullable Requirement requirement) {
+ public final Measure<G> setRequirement(@Nullable Requirement requirement) {
this.requirement = requirement;
return this;
}
@@ -671,7 +671,7 @@ public class Measure<G extends Serializable> implements Serializable {
* @since 2.14
*/
@Beta
- public Measure setPersonId(@Nullable Integer i) {
+ public Measure<G> setPersonId(@Nullable Integer i) {
this.personId = i;
return this;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
index 987be1d33e4..679d91c7f95 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
@@ -274,7 +274,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
/**
* For internal use only
*/
- public Metric setId(@Nullable Integer id) {
+ public Metric<G> setId(@Nullable Integer id) {
this.id = id;
return this;
}
@@ -292,7 +292,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param formula the formula
* @return this
*/
- public Metric setFormula(Formula formula) {
+ public Metric<G> setFormula(Formula formula) {
this.formula = formula;
return this;
}
@@ -310,7 +310,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param qualitative whether the metric is qualitative
* @return this
*/
- public Metric setQualitative(Boolean qualitative) {
+ public Metric<G> setQualitative(Boolean qualitative) {
this.qualitative = qualitative;
return this;
}
@@ -328,7 +328,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param key the key
* @return this
*/
- public Metric setKey(String key) {
+ public Metric<G> setKey(String key) {
this.key = key;
return this;
}
@@ -346,7 +346,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param type the type
* @return this
*/
- public Metric setType(ValueType type) {
+ public Metric<G> setType(ValueType type) {
this.type = type;
return this;
}
@@ -365,7 +365,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param description the description
* @return this
*/
- public Metric setDescription(@Nullable String description) {
+ public Metric<G> setDescription(@Nullable String description) {
this.description = description;
return this;
}
@@ -383,7 +383,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param userManaged whether the metric is user managed
* @return this
*/
- public Metric setUserManaged(Boolean userManaged) {
+ public Metric<G> setUserManaged(Boolean userManaged) {
this.userManaged = userManaged;
return this;
}
@@ -401,7 +401,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param enabled whether the metric is enabled
* @return this
*/
- public Metric setEnabled(Boolean enabled) {
+ public Metric<G> setEnabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
@@ -418,7 +418,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
*
* @param direction the direction
*/
- public Metric setDirection(Integer direction) {
+ public Metric<G> setDirection(Integer direction) {
this.direction = direction;
return this;
}
@@ -436,7 +436,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param domain the domain
* @return this
*/
- public Metric setDomain(String domain) {
+ public Metric<G> setDomain(String domain) {
this.domain = domain;
return this;
}
@@ -454,7 +454,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param name the name
* @return this
*/
- public Metric setName(String name) {
+ public Metric<G> setName(String name) {
this.name = name;
return this;
}
@@ -471,7 +471,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
/**
* @return this
*/
- public Metric setWorstValue(@Nullable Double d) {
+ public Metric<G> setWorstValue(@Nullable Double d) {
this.worstValue = d;
return this;
}
@@ -480,7 +480,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
* @param bestValue the best value. It can be null.
* @return this
*/
- public Metric setBestValue(@Nullable Double bestValue) {
+ public Metric<G> setBestValue(@Nullable Double bestValue) {
this.bestValue = bestValue;
return this;
}
@@ -512,7 +512,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
return ValueType.PERCENT.equals(type);
}
- public Metric setOptimizedBestValue(@Nullable Boolean b) {
+ public Metric<G> setOptimizedBestValue(@Nullable Boolean b) {
this.optimizedBestValue = b;
return this;
}
@@ -529,7 +529,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
return hidden;
}
- public Metric setHidden(Boolean hidden) {
+ public Metric<G> setHidden(Boolean hidden) {
this.hidden = hidden;
return this;
}
@@ -565,7 +565,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
*
* @return this
*/
- public Metric merge(final Metric with) {
+ public Metric<G> merge(final Metric with) {
this.description = with.description;
this.domain = with.domain;
this.enabled = with.enabled;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
index 418caff6e84..3f6654a6aaf 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
@@ -26,18 +26,22 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
+
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
+
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
@@ -351,7 +355,7 @@ public interface WebService extends Definable<WebService.Context> {
* Creates the parameter {@link org.sonar.api.server.ws.WebService.Param#FIELDS}, which is
* used to restrict the number of fields returned in JSON response.
*/
- public NewAction addFieldsParam(Collection possibleValues) {
+ public NewAction addFieldsParam(Collection<?> possibleValues) {
createParam(Param.FIELDS)
.setDescription("Comma-separated list of the fields to be returned in response. All the fields are returned by default.")
.setPossibleValues(possibleValues);
@@ -565,7 +569,7 @@ public interface WebService extends Definable<WebService.Context> {
* @since 4.4
*/
public NewParam setPossibleValues(@Nullable Object... values) {
- return setPossibleValues(values == null ? (Collection) null : Arrays.asList(values));
+ return setPossibleValues(values == null ? Collections.emptyList() : Arrays.asList(values));
}
/**
@@ -581,7 +585,7 @@ public interface WebService extends Definable<WebService.Context> {
*
* @since 4.4
*/
- public NewParam setPossibleValues(@Nullable Collection values) {
+ public NewParam setPossibleValues(@Nullable Collection<?> values) {
if (values == null || values.isEmpty()) {
this.possibleValues = null;
} else {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java
index 006aae7c064..6e1b4fc01a6 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java
@@ -328,10 +328,10 @@ public class WebServiceTest {
NewAction create = newController.createAction("create").setHandler(mock(RequestHandler.class));
create.createParam("status")
.setDefaultValue(null)
- .setPossibleValues((Collection) null)
+ .setPossibleValues(Collections.emptyList())
.setExampleValue(null);
create.createParam("max")
- .setPossibleValues((String[]) null);
+ .setPossibleValues((Object[]) null);
newController.done();
}
}.define(context);