Skip to content

Commit

Permalink
Fix checkstyle issues in gcloud-java-core (#871)
Browse files Browse the repository at this point in the history
* Fix checkstyle issues in gcloud-java-core
  • Loading branch information
mziccard authored and aozarov committed Apr 7, 2016
1 parent 5b4ea32 commit a8ec412
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String apply(FieldSelector fieldSelector) {
};

private static String selector(List<? extends FieldSelector> required, FieldSelector[] others,
String... extraResourceFields) {
String... extraResourceFields) {
Set<String> fieldStrings = Sets.newHashSetWithExpectedSize(required.size() + others.length);
fieldStrings.addAll(Lists.transform(required, FIELD_TO_STRING_FUNCTION));
fieldStrings.addAll(Lists.transform(Arrays.asList(others), FIELD_TO_STRING_FUNCTION));
Expand Down
7 changes: 3 additions & 4 deletions gcloud-java-core/src/main/java/com/google/gcloud/Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@
/**
* Interface for Google Cloud paginated results.
*
* <p>
* Use {@code Page} to iterate through all values (also in next pages):
* <p>Use {@code Page} to iterate through all values (also in next pages):
* <pre> {@code
* Page<T> page = ...; // get a Page<T> instance
* Iterator<T> iterator = page.iterateAll();
* while (iterator.hasNext()) {
* T value = iterator.next();
* // do something with value
* }}</pre>
* <p>
* Or handle pagination explicitly:
*
* <p>Or handle pagination explicitly:
* <pre> {@code
* Page<T> page = ...; // get a Page<T> instance
* while (page != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
/**
* Implementation of this interface can persist their state and restore from it.
*
* <p>
* A typical capture usage:
* <p>A typical capture usage:
* <pre> {@code
* X restorableObj; // X instanceof Restorable<X>
* RestorableState<X> state = restorableObj.capture();
* .. persist state
* }</pre>
*
* A typical restore usage:
* <p>A typical restore usage:
* <pre> {@code
* RestorableState<X> state = ... // read from persistence
* X restorableObj = state.restore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* A common interface for restorable states. Implementations of {@code RestorableState} are capable
* of saving the state of an object to restore it for later use.
*
* Implementations of this class must implement {@link java.io.Serializable} to ensure that the
* <p>Implementations of this class must implement {@link java.io.Serializable} to ensure that the
* state of a the object can be correctly serialized.
*
* @param <T> the restored object's type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public abstract class ServiceOptions<ServiceT extends Service<OptionsT>, Service
/**
* A base interface for all {@link HttpTransport} factories.
*
* Implementation must provide a public no-arg constructor. Loading of a factory implementation is
* done via {@link java.util.ServiceLoader}.
* <p>Implementation must provide a public no-arg constructor. Loading of a factory implementation
* is done via {@link java.util.ServiceLoader}.
*/
public interface HttpTransportFactory {
HttpTransport create();
Expand Down Expand Up @@ -129,7 +129,7 @@ public HttpTransport create() {
* A class providing access to the current time in milliseconds. This class is mainly used for
* testing and will be replaced by Java8's {@code java.time.Clock}.
*
* Implementations should implement {@code Serializable} wherever possible and must document
* <p>Implementations should implement {@code Serializable} wherever possible and must document
* whether or not they do support serialization.
*/
public abstract static class Clock {
Expand Down Expand Up @@ -490,7 +490,7 @@ protected static String appEngineProjectId() {
protected static String serviceAccountProjectId() {
String project = null;
String credentialsPath = System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
if(credentialsPath != null) {
if (credentialsPath != null) {
try (InputStream credentialsStream = new FileInputStream(credentialsPath)) {
JSONObject json = new JSONObject(new JSONTokener(credentialsStream));
project = json.getString("project_id");
Expand Down Expand Up @@ -518,9 +518,8 @@ public ServiceRpcT rpc() {
}

/**
* Returns the project id.
*
* Return value can be null (for services that don't require a project id).
* Returns the project id. Return value can be null (for services that don't require a project
* id).
*/
public String projectId() {
return projectId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
import com.google.gcloud.ServiceOptions;

/**
* A base interface for all service RPC factories.
*
* Implementation must provide a public no-arg constructor.
* Loading of a factory implementation is done via {@link java.util.ServiceLoader}.
* A base interface for all service RPC factories. Implementation must provide a public no-arg
* constructor. Loading of a factory implementation is done via {@link java.util.ServiceLoader}.
*/
@SuppressWarnings("rawtypes")
public interface ServiceRpcFactory<ServiceRpcT, OptionsT extends ServiceOptions> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected BaseState.Builder<CustomServiceOptions, Serializable> stateBuilder() {
}

@Test
public void testConstructor() throws IOException {
public void testConstructor() {
assertEquals(null, channel.options());
assertEquals(ENTITY, channel.entity());
assertEquals(0, channel.position());
Expand All @@ -108,7 +108,7 @@ public void testValidateOpen() throws IOException {
}

@Test
public void testChunkSize() throws IOException {
public void testChunkSize() {
channel.chunkSize(42);
assertEquals(MIN_CHUNK_SIZE, channel.chunkSize());
channel.chunkSize(2 * MIN_CHUNK_SIZE);
Expand Down

0 comments on commit a8ec412

Please sign in to comment.