Skip to content

Commit

Permalink
Add generic type to ServiceOption definition + minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay Kannan committed Dec 10, 2015
1 parent c36b857 commit d0eec71
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ public PageImpl(NextPageFetcher<T> pageFetcher, String cursor, Iterable<T> resul
this.results = results;
}

@SuppressWarnings("unchecked")
@Override
public Iterable<T> values() {
return results == null ? Collections.EMPTY_LIST : results;
return results == null ? Collections.<T>emptyList() : results;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@SuppressWarnings("rawtypes")
public abstract class ServiceOptions<
ServiceT extends Service,
ServiceRpcT,
OptionsT extends ServiceOptions<ServiceT, ServiceRpcT, OptionsT>>
implements Serializable {
public abstract class ServiceOptions<ServiceT extends Service<OptionsT>, ServiceRpcT,
OptionsT extends ServiceOptions<ServiceT, ServiceRpcT, OptionsT>> implements Serializable {

private static final String DEFAULT_HOST = "https://www.googleapis.com";
private static final long serialVersionUID = 1203687993961393350L;
Expand Down Expand Up @@ -154,9 +150,7 @@ private Object readResolve() throws ObjectStreamException {
}
}

protected abstract static class Builder<
ServiceT extends Service,
ServiceRpcT,
protected abstract static class Builder<ServiceT extends Service<OptionsT>, ServiceRpcT,
OptionsT extends ServiceOptions<ServiceT, ServiceRpcT, OptionsT>,
B extends Builder<ServiceT, ServiceRpcT, OptionsT, B>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private class TestBuilder extends Value.BaseBuilder<Set, Value<Set>, TestBuilder
super(ValueType.LIST);
}

@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({"unchecked"})
@Override
public Value<Set> build() {
return new Value(this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ public void testStateEquals() {
.times(2);
replay(storageRpcMock);
writer = new BlobWriteChannelImpl(options, BLOB_INFO, EMPTY_RPC_OPTIONS);
@SuppressWarnings("resource") // avoid closing when you don't want partial writes to GCS
// avoid closing when you don't want partial writes to GCS upon failure
@SuppressWarnings("resource")
BlobWriteChannel writer2 = new BlobWriteChannelImpl(options, BLOB_INFO, EMPTY_RPC_OPTIONS);
RestorableState<BlobWriteChannel> state = writer.capture();
RestorableState<BlobWriteChannel> state2 = writer2.capture();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public static void beforeClass() {
}

@AfterClass
public static void afterClass()
throws ExecutionException, InterruptedException {
public static void afterClass() throws ExecutionException, InterruptedException {
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS)) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ public void testWriteChannelState() throws IOException, ClassNotFoundException {
.projectId("p2")
.retryParams(RetryParams.defaultInstance())
.build();
@SuppressWarnings("resource") // avoid closing when you don't want partial writes to GCS
// avoid closing when you don't want partial writes to GCS upon failure
@SuppressWarnings("resource")
BlobWriteChannelImpl writer = new BlobWriteChannelImpl(
options, BlobInfo.builder(BlobId.of("b", "n")).build(), "upload-id");
RestorableState<BlobWriteChannel> state = writer.capture();
Expand Down

0 comments on commit d0eec71

Please sign in to comment.