8000 remove redundant throws clauses by qweek · Pull Request #386 · rsocket/rsocket-java · GitHub
[go: up one dir, main page]

Skip to content

remove redundant throws clauses #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
suppress unchecked method invocation
generify return values
suppress unchecked method invocation
  • Loading branch information
qweek committed Sep 13, 2017
commit 49a4cce2da8acbed3f870f53e6776d6e0fc85015
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ subprojects {
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
options.compilerArgs << "-Xlint:deprecation" // << "-Xlint:unchecked"
}

ext {
Expand Down
1 change: 0 additions & 1 deletion rsocket-core/src/main/java/io/rsocket/RSocketClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ private void handleStreamZero(FrameType type, Frame frame) {
}
}

@SuppressWarnings("unchecked")
private void handleFrame(int streamId, FrameType type, Frame frame) {
Subscriber<Payload> receiver;
synchronized (this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void testRequest() {

@Test
public void testStream() throws Exception {
Subscriber subscriber = TestSubscriber.createCancelling();
Subscriber<Payload> subscriber = TestSubscriber.createCancelling();
client.requestStream(new PayloadImpl("start")).subscribe(subscriber);

verify(subscriber).onSubscribe(any());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.netflix.spectator.api.Timer;
import io.rsocket.Payload;
import io.rsocket.RSocket;
import java.lang.reflect.Array;
import java.util.concurrent.TimeUnit;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
Expand Down Expand Up @@ -99,16 +98,15 @@ public SpectatorRSocket(Registry registry, RSocket delegate, String... tags) {
registry.timer("reactiveSocketStats", concatenate(tags, "metadataPush", "timer"));
}

static <T> T[] concatenate(T[] a, T... b) {
private static String[] concatenate(String[] a, String... b) {
if (a == null || a.length == 0) {
return b;
}

int aLen = a.length;
int bLen = b.length;

@SuppressWarnings("unchecked")
T[] c = (T[]) Array.newInstance(a.getClass().getComponentType(), aLen + bLen);
String[] c = new String[aLen + bLen];
System.arraycopy(a, 0, c, 0, aLen);
System.arraycopy(b, 0, c, aLen, bLen);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ public RunnerRSocket() {}
@Override
public Mono<Payload> requestResponse(Payload payload) {
Map<String, Object> clientTest = parseTCKMessage(payload, "runnerExecuteTest");
@SuppressWarnings("unchecked")
Map<String, Object> setup = (Map<String, Object>) clientTest.get("setup");
@SuppressWarnings("unchecked")
Map<String, Object> test = (Map<String, Object>) clientTest.get("test");
@SuppressWarnings("unchecked")
Map<String, Object> tck1Definition = (Map<String, Object>) test.get("tck1Definition");

String url = (String) setup.get("url");
Expand Down Expand Up @@ -68,8 +71,11 @@ public Mono<Payload> requestResponse(Payload payload) {
public Flux<Payload> requestStream(Payload payload) {
Map<String, Object> serverTest = parseTCKMessage(payload, "runnerExecuteTest");

@SuppressWarnings("unchecked")
Map<String, Object> setup = (Map<String, Object>) serverTest.get("setup");
@SuppressWarnings("unchecked")
Map<String, Object> test = (Map<String, Object>) serverTest.get("test");
@SuppressWarnings("unchecked")
Map<String, Object> tck1Definition = (Map<String, Object>) test.get("tck1Definition");

// TODO check version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public static String result(Map<String, Object> t) {
}

public static void printTestRunResults(Map<String, Object> suite) {
@SuppressWarnings("unchecked")
Map<String, Object> setup = (Map<String, Object>) suite.get("setup");
@SuppressWarnings("unchecked")
List<Map<String, Object>> tests = (List<Map<String, Object>>) suite.get("tests");

for (Map<String, Object> t : tests) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public static <T> Subscriber<T> create() {
}

public static <T> Subscriber<T> create(long initialRequest) {
Subscriber mock = mock(Subscriber.class);
@SuppressWarnings("unchecked")
Subscriber<T> mock = mock(Subscriber.class);

Mockito.doAnswer(
invocation -> {
Expand All @@ -34,7 +35,8 @@ public static Payload anyPayload() {
}

public static Subscriber<Payload> createCancelling() {
Subscriber mock = mock(Subscriber.class);
@SuppressWarnings("unchecked")
Subscriber<Payload> mock = mock(Subscriber.class);

Mockito.doAnswer(
invocation -> {
Expand Down
0