Skip to content

Commit d0eec71

Browse files
author
Ajay Kannan
committed
Add generic type to ServiceOption definition + minor fixes
1 parent c36b857 commit d0eec71

6 files changed

Lines changed: 10 additions & 16 deletions

File tree

gcloud-java-core/src/main/java/com/google/gcloud/PageImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ public PageImpl(NextPageFetcher<T> pageFetcher, String cursor, Iterable<T> resul
7171
this.results = results;
7272
}
7373

74-
@SuppressWarnings("unchecked")
7574
@Override
7675
public Iterable<T> values() {
77-
return results == null ? Collections.EMPTY_LIST : results;
76+
return results == null ? Collections.<T>emptyList() : results;
7877
}
7978

8079
@Override

gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,8 @@
5353
import java.util.regex.Matcher;
5454
import java.util.regex.Pattern;
5555

56-
@SuppressWarnings("rawtypes")
57-
public abstract class ServiceOptions<
58-
ServiceT extends Service,
59-
ServiceRpcT,
60-
OptionsT extends ServiceOptions<ServiceT, ServiceRpcT, OptionsT>>
61-
implements Serializable {
56+
public abstract class ServiceOptions<ServiceT extends Service<OptionsT>, ServiceRpcT,
57+
OptionsT extends ServiceOptions<ServiceT, ServiceRpcT, OptionsT>> implements Serializable {
6258

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

157-
protected abstract static class Builder<
158-
ServiceT extends Service,
159-
ServiceRpcT,
153+
protected abstract static class Builder<ServiceT extends Service<OptionsT>, ServiceRpcT,
160154
OptionsT extends ServiceOptions<ServiceT, ServiceRpcT, OptionsT>,
161155
B extends Builder<ServiceT, ServiceRpcT, OptionsT, B>> {
162156

gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ValueTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private class TestBuilder extends Value.BaseBuilder<Set, Value<Set>, TestBuilder
6666
super(ValueType.LIST);
6767
}
6868

69-
@SuppressWarnings({"unchecked", "rawtypes"})
69+
@SuppressWarnings({"unchecked"})
7070
@Override
7171
public Value<Set> build() {
7272
return new Value(this) {

gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobWriteChannelImplTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ public void testStateEquals() {
234234
.times(2);
235235
replay(storageRpcMock);
236236
writer = new BlobWriteChannelImpl(options, BLOB_INFO, EMPTY_RPC_OPTIONS);
237-
@SuppressWarnings("resource") // avoid closing when you don't want partial writes to GCS
237+
// avoid closing when you don't want partial writes to GCS upon failure
238+
@SuppressWarnings("resource")
238239
BlobWriteChannel writer2 = new BlobWriteChannelImpl(options, BLOB_INFO, EMPTY_RPC_OPTIONS);
239240
RestorableState<BlobWriteChannel> state = writer.capture();
240241
RestorableState<BlobWriteChannel> state2 = writer2.capture();

gcloud-java-storage/src/test/java/com/google/gcloud/storage/ITStorageTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public static void beforeClass() {
7474
}
7575

7676
@AfterClass
77-
public static void afterClass()
78-
throws ExecutionException, InterruptedException {
77+
public static void afterClass() throws ExecutionException, InterruptedException {
7978
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS)) {
8079
if (log.isLoggable(Level.WARNING)) {
8180
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);

gcloud-java-storage/src/test/java/com/google/gcloud/storage/SerializationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ public void testWriteChannelState() throws IOException, ClassNotFoundException {
128128
.projectId("p2")
129129
.retryParams(RetryParams.defaultInstance())
130130
.build();
131-
@SuppressWarnings("resource") // avoid closing when you don't want partial writes to GCS
131+
// avoid closing when you don't want partial writes to GCS upon failure
132+
@SuppressWarnings("resource")
132133
BlobWriteChannelImpl writer = new BlobWriteChannelImpl(
133134
options, BlobInfo.builder(BlobId.of("b", "n")).build(), "upload-id");
134135
RestorableState<BlobWriteChannel> state = writer.capture();

0 commit comments

Comments
 (0)