From a8ec412e31e65a5a846c737828f7b17a187f5aeb Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Thu, 7 Apr 2016 18:05:45 +0200 Subject: [PATCH] Fix checkstyle issues in gcloud-java-core (#871) * Fix checkstyle issues in gcloud-java-core --- .../main/java/com/google/gcloud/FieldSelector.java | 2 +- .../src/main/java/com/google/gcloud/Page.java | 7 +++---- .../src/main/java/com/google/gcloud/Restorable.java | 5 ++--- .../java/com/google/gcloud/RestorableState.java | 2 +- .../main/java/com/google/gcloud/ServiceOptions.java | 13 ++++++------- .../com/google/gcloud/spi/ServiceRpcFactory.java | 6 ++---- .../com/google/gcloud/BaseWriteChannelTest.java | 4 ++-- 7 files changed, 17 insertions(+), 22 deletions(-) diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/FieldSelector.java b/gcloud-java-core/src/main/java/com/google/gcloud/FieldSelector.java index be6ab73d00bf..fc6e77242082 100644 --- a/gcloud-java-core/src/main/java/com/google/gcloud/FieldSelector.java +++ b/gcloud-java-core/src/main/java/com/google/gcloud/FieldSelector.java @@ -54,7 +54,7 @@ public String apply(FieldSelector fieldSelector) { }; private static String selector(List required, FieldSelector[] others, - String... extraResourceFields) { + String... extraResourceFields) { Set 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)); diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/Page.java b/gcloud-java-core/src/main/java/com/google/gcloud/Page.java index 53f3a3842a18..fe192c0c0ceb 100644 --- a/gcloud-java-core/src/main/java/com/google/gcloud/Page.java +++ b/gcloud-java-core/src/main/java/com/google/gcloud/Page.java @@ -21,8 +21,7 @@ /** * Interface for Google Cloud paginated results. * - *

- * Use {@code Page} to iterate through all values (also in next pages): + *

Use {@code Page} to iterate through all values (also in next pages): *

 {@code
  * Page page = ...; // get a Page instance
  * Iterator iterator = page.iterateAll();
@@ -30,8 +29,8 @@
  *   T value = iterator.next();
  *   // do something with value
  * }}
- *

- * Or handle pagination explicitly: + * + *

Or handle pagination explicitly: *

 {@code
  * Page page = ...; // get a Page instance
  * while (page != null) {
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/Restorable.java b/gcloud-java-core/src/main/java/com/google/gcloud/Restorable.java
index 0b573522e370..d92c70eb9883 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/Restorable.java
+++ b/gcloud-java-core/src/main/java/com/google/gcloud/Restorable.java
@@ -19,15 +19,14 @@
 /**
  * Implementation of this interface can persist their state and restore from it.
  *
- * 

- * A typical capture usage: + *

A typical capture usage: *

 {@code
  * X restorableObj; // X instanceof Restorable
  * RestorableState state = restorableObj.capture();
  * .. persist state
  * }
* - * A typical restore usage: + *

A typical restore usage: *

 {@code
  * RestorableState state = ... // read from persistence
  * X restorableObj = state.restore();
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/RestorableState.java b/gcloud-java-core/src/main/java/com/google/gcloud/RestorableState.java
index d6ce736ae856..009a86e545f5 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/RestorableState.java
+++ b/gcloud-java-core/src/main/java/com/google/gcloud/RestorableState.java
@@ -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
+ * 

Implementations of this class must implement {@link java.io.Serializable} to ensure that the * state of a the object can be correctly serialized. * * @param the restored object's type diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java b/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java index d53cfcdafe24..6a8656fcfa8a 100644 --- a/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java +++ b/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java @@ -100,8 +100,8 @@ public abstract class ServiceOptions, 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}. + *

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(); @@ -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 + *

Implementations should implement {@code Serializable} wherever possible and must document * whether or not they do support serialization. */ public abstract static class Clock { @@ -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"); @@ -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; diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java b/gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java index d19f6047e4b2..8ee964ca8f39 100644 --- a/gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java +++ b/gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java @@ -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 { diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/BaseWriteChannelTest.java b/gcloud-java-core/src/test/java/com/google/gcloud/BaseWriteChannelTest.java index 6d5306a3bc7f..b44157b6557b 100644 --- a/gcloud-java-core/src/test/java/com/google/gcloud/BaseWriteChannelTest.java +++ b/gcloud-java-core/src/test/java/com/google/gcloud/BaseWriteChannelTest.java @@ -82,7 +82,7 @@ protected BaseState.Builder stateBuilder() { } @Test - public void testConstructor() throws IOException { + public void testConstructor() { assertEquals(null, channel.options()); assertEquals(ENTITY, channel.entity()); assertEquals(0, channel.position()); @@ -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);