Skip to content

Commit c36b857

Browse files
author
Ajay Kannan
committed
fix checkstyle issues and warnings
1 parent c920387 commit c36b857

28 files changed

Lines changed: 58 additions & 44 deletions

File tree

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

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

74+
@SuppressWarnings("unchecked")
7475
@Override
7576
public Iterable<T> values() {
7677
return results == null ? Collections.EMPTY_LIST : results;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* Implementation must provide a public no-arg constructor.
2323
* Loading of a factory implementation is done via {@link java.util.ServiceLoader}.
2424
*/
25+
@SuppressWarnings("rawtypes")
2526
public interface ServiceFactory<ServiceT extends Service, ServiceOptionsT extends ServiceOptions> {
2627

2728
ServiceT create(ServiceOptionsT serviceOptions);

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import java.util.regex.Matcher;
5454
import java.util.regex.Pattern;
5555

56+
@SuppressWarnings("rawtypes")
5657
public abstract class ServiceOptions<
5758
ServiceT extends Service,
5859
ServiceRpcT,
@@ -305,8 +306,8 @@ protected ServiceOptions(Class<? extends ServiceFactory<ServiceT, OptionsT>> ser
305306
if (projectIdRequired()) {
306307
checkArgument(
307308
projectId != null,
308-
"A project ID is required for this service but could not be determined from the builder or "
309-
+ "the environment. Please set a project ID using the builder.");
309+
"A project ID is required for this service but could not be determined from the builder "
310+
+ "or the environment. Please set a project ID using the builder.");
310311
}
311312
host = firstNonNull(builder.host, defaultHost());
312313
httpTransportFactory = firstNonNull(builder.httpTransportFactory,
@@ -453,13 +454,15 @@ protected static String getAppEngineProjectId() {
453454
}
454455
}
455456

457+
@SuppressWarnings("unchecked")
456458
public ServiceT service() {
457459
if (service == null) {
458460
service = serviceFactory.create((OptionsT) this);
459461
}
460462
return service;
461463
}
462464

465+
@SuppressWarnings("unchecked")
463466
public ServiceRpcT rpc() {
464467
if (rpc == null) {
465468
rpc = serviceRpcFactory.create((OptionsT) this);
@@ -587,6 +590,7 @@ private void readObject(ObjectInputStream input) throws IOException, ClassNotFou
587590
authCredentials = authCredentialsState != null ? authCredentialsState.restore() : null;
588591
}
589592

593+
@SuppressWarnings("unchecked")
590594
private static <T> T newInstance(String className) throws IOException, ClassNotFoundException {
591595
try {
592596
return (T) Class.forName(className).newInstance();

gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* Implementation must provide a public no-arg constructor.
2525
* Loading of a factory implementation is done via {@link java.util.ServiceLoader}.
2626
*/
27+
@SuppressWarnings("rawtypes")
2728
public interface ServiceRpcFactory<ServiceRpcT, OptionsT extends ServiceOptions> {
2829

2930
ServiceRpcT create(OptionsT options);

gcloud-java-core/src/test/java/com/google/gcloud/PageImplTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
import org.junit.Test;
2424

25-
import java.util.Collections;
26-
2725
public class PageImplTest {
2826

2927
private static final ImmutableList<String> VALUES = ImmutableList.of("1", "2");

gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ static DatastoreException translateAndThrow(DatastoreRpcException exception) {
146146
* @throws DatastoreException every time
147147
*/
148148
static DatastoreException throwInvalidRequest(String massage, Object... params) {
149-
throw new DatastoreException(DatastoreError.FAILED_PRECONDITION, String.format(massage, params));
149+
throw new DatastoreException(
150+
DatastoreError.FAILED_PRECONDITION, String.format(massage, params));
150151
}
151152

152153
static DatastoreException propagateUserException(Exception ex) {

gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreOptions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,13 @@ protected String defaultProject() {
157157
return projectId != null ? projectId : super.defaultProject();
158158
}
159159

160+
@SuppressWarnings("unchecked")
160161
@Override
161162
protected DatastoreFactory defaultServiceFactory() {
162163
return DefaultDatastoreFactory.INSTANCE;
163164
}
164165

166+
@SuppressWarnings("unchecked")
165167
@Override
166168
protected DatastoreRpcFactory defaultRpcFactory() {
167169
return DefaultDatastoreRpcFactory.INSTANCE;
@@ -199,6 +201,7 @@ protected Set<String> scopes() {
199201
return SCOPES;
200202
}
201203

204+
@SuppressWarnings("unchecked")
202205
@Override
203206
public Builder toBuilder() {
204207
return new Builder(this);

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import org.junit.Before;
3131
import org.junit.Test;
3232

33-
import java.io.IOException;
34-
3533
public class DatastoreOptionsTest {
3634

3735
private static final String PROJECT_ID = "project_id";
@@ -41,7 +39,7 @@ public class DatastoreOptionsTest {
4139
private DatastoreOptions.Builder options;
4240

4341
@Before
44-
public void setUp() throws IOException, InterruptedException {
42+
public void setUp() {
4543
datastoreRpcFactory = EasyMock.createMock(DatastoreRpcFactory.class);
4644
datastoreRpc = EasyMock.createMock(DatastoreRpc.class);
4745
options = DatastoreOptions.builder()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public static void beforeClass() throws IOException, InterruptedException {
121121
}
122122

123123
@Before
124-
public void setUp() throws IOException, InterruptedException {
124+
public void setUp() {
125125
options = DatastoreOptions.builder()
126126
.projectId(PROJECT_ID)
127127
.host("http://localhost:" + PORT)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ public class ValueTest {
6060

6161
private ImmutableMap<ValueType, Value<?>> typeToValue;
6262

63+
@SuppressWarnings("rawtypes")
6364
private class TestBuilder extends Value.BaseBuilder<Set, Value<Set>, TestBuilder> {
6465
TestBuilder() {
6566
super(ValueType.LIST);
6667
}
6768

69+
@SuppressWarnings({"unchecked", "rawtypes"})
6870
@Override
6971
public Value<Set> build() {
7072
return new Value(this) {
@@ -197,6 +199,7 @@ public void testGet() throws Exception {
197199
@Test
198200
public void testToBuilder() throws Exception {
199201
Set<String> content = Collections.singleton("bla");
202+
@SuppressWarnings("rawtypes")
200203
ValueBuilder builder = new TestBuilder();
201204
builder.meaning(1).set(content).indexed(true);
202205
Value<?> value = builder.build();

0 commit comments

Comments
 (0)