diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-03-09 14:08:43 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-03-12 09:24:23 +0100 |
commit | 35749faa8b9f588b3269f3bcf09a776c0889e883 (patch) | |
tree | 48ab0b5b81a2d08870359887cbf941d71c46e3b3 /sonar-ws | |
parent | f81bf3c5f5caf93173c53499c13a7e54b60b28f9 (diff) | |
download | sonarqube-35749faa8b9f588b3269f3bcf09a776c0889e883.tar.gz sonarqube-35749faa8b9f588b3269f3bcf09a776c0889e883.zip |
Fix some Java compiler warnings
Diffstat (limited to 'sonar-ws')
3 files changed, 7 insertions, 3 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java index 058ff52e92b..8f76a4f1ecb 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java @@ -67,6 +67,7 @@ abstract class BaseRequest<SELF extends BaseRequest> implements WsRequest { /** * Expected media type of response. Default is {@link MediaTypes#JSON}. */ + @SuppressWarnings("unchecked") public SELF setMediaType(String s) { requireNonNull(s, "media type of response cannot be null"); this.mediaType = s; @@ -93,6 +94,7 @@ abstract class BaseRequest<SELF extends BaseRequest> implements WsRequest { return setSingleValueParam(key, value); } + @SuppressWarnings("unchecked") private SELF setSingleValueParam(String key, @Nullable Object value) { checkArgument(!isNullOrEmpty(key), "a WS parameter key cannot be null"); if (value == null) { @@ -103,6 +105,7 @@ abstract class BaseRequest<SELF extends BaseRequest> implements WsRequest { return (SELF) this; } + @SuppressWarnings("unchecked") public SELF setParam(String key, @Nullable Collection<? extends Object> values) { checkArgument(!isNullOrEmpty(key), "a WS parameter key cannot be null"); if (values == null || values.isEmpty()) { @@ -140,6 +143,7 @@ abstract class BaseRequest<SELF extends BaseRequest> implements WsRequest { return headers; } + @SuppressWarnings("unchecked") public SELF setHeader(String name, @Nullable String value) { requireNonNull(name, "Header name can't be null"); headers.setValue(name, value); diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/LocalWsConnectorTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/LocalWsConnectorTest.java index 79b6c6e4583..b5c699c723f 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/LocalWsConnectorTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/LocalWsConnectorTest.java @@ -32,8 +32,8 @@ import org.sonarqube.ws.MediaTypes; import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/ServiceTester.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/ServiceTester.java index ea76f6835f7..685b9af7f81 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/ServiceTester.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/ServiceTester.java @@ -34,7 +34,7 @@ import org.junit.rules.ExternalResource; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.spy; |