Make inner classes static where possible

Found via error-prone.
This commit is contained in:
Andrew Gaul 2016-06-01 20:02:27 -07:00
parent 63bfc2f6e8
commit a67ae3f27b
11 changed files with 17 additions and 17 deletions

View File

@ -231,7 +231,7 @@ public class SecurityGroupApiLiveTest extends BaseComputeServiceContextLiveTest
}
}
public final class TCPPort80AllIPs implements Predicate<IpPermission> {
public static final class TCPPort80AllIPs implements Predicate<IpPermission> {
@Override
public boolean apply(IpPermission arg0) {
return arg0.getIpProtocol() == IpProtocol.TCP && arg0.getFromPort() == 80 && arg0.getToPort() == 80

View File

@ -140,7 +140,7 @@ public final class DeserializationConstructorAndReflectiveTypeAdapterFactory imp
getParameterReaders(gson, deserializationTarget));
}
private final class DeserializeIntoParameterizedConstructor<T> extends TypeAdapter<T> {
private static final class DeserializeIntoParameterizedConstructor<T> extends TypeAdapter<T> {
private final TypeAdapter<T> serializer;
private final Invokable<T, T> parameterizedCtor;
private final Map<String, ParameterReader<?>> parameterReaders;

View File

@ -100,7 +100,7 @@ public abstract class NullHackJsonLiteralAdapter<L> extends TypeAdapter<L> {
}
}
public final class NullReplacingWriter extends Writer {
public static final class NullReplacingWriter extends Writer {
private final Writer delegate;
private final String nullReplacement;

View File

@ -50,7 +50,7 @@ public class DateServiceTest extends PerformanceTest {
protected TestData[] testData;
protected class TestData {
protected static class TestData {
public final String iso8601DateString;
public final String iso8601DateStringTz;

View File

@ -32,7 +32,7 @@ import static org.testng.Assert.assertNotEquals;
@Test(groups = "unit", sequential = true)
public class WireTest {
class BufferLogger implements Logger {
static class BufferLogger implements Logger {
StringBuilder buff = new StringBuilder();
public void debug(String message, Object... args) {

View File

@ -81,7 +81,7 @@ public class BaseViewTest {
}
}
public class DummyView extends BaseView {
public static class DummyView extends BaseView {
protected DummyView(ApiContext<DummyApi> context) {
super(context, new TypeToken<ApiContext<DummyApi>>() {

View File

@ -40,7 +40,7 @@ public class ProxyForURITest {
private Optional<HostAndPort> hostAndPort = Optional.of(HostAndPort.fromParts("proxy.example.com", 8080));
private Optional<Credentials> creds = Optional.of(new Credentials("user", "pwd"));
private class MyProxyConfig implements ProxyConfig {
private static class MyProxyConfig implements ProxyConfig {
private boolean useSystem;
private boolean jvmProxyEnabled;
private Type type;

View File

@ -633,7 +633,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertPayloadEquals(request, "", "application/octet-stream", false);
}
private class TestHttpRequestOptions extends BaseHttpRequestOptions {
private static class TestHttpRequestOptions extends BaseHttpRequestOptions {
TestHttpRequestOptions payload(String payload) {
this.payload = payload;
return this;
@ -720,7 +720,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertPayloadEquals(request, "last_payload_wins!", "application/unknown", false);
}
public class TestCustomMethod {
public static class TestCustomMethod {
@FOO
public void foo() {
}
@ -738,7 +738,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
void foo();
}
public class TestOverridden implements Parent {
public static class TestOverridden implements Parent {
@POST
public void foo() {
}
@ -1808,7 +1808,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertEquals(headers.get("x-amz-copy-source"), ImmutableList.of("/eggs/robot"));
}
public class TestReplaceQueryOptions extends BaseHttpRequestOptions {
public static class TestReplaceQueryOptions extends BaseHttpRequestOptions {
public TestReplaceQueryOptions() {
this.queryParameters.put("x-amz-copy-source", "/{bucket}");
}
@ -2198,7 +2198,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
ImmutableList.of(dateService.rfc822DateFormat(date)));
}
public class PrefixOptions extends BaseHttpRequestOptions {
public static class PrefixOptions extends BaseHttpRequestOptions {
public PrefixOptions withPrefix(String prefix) {
queryParameters.put("prefix", checkNotNull(prefix, "prefix"));
return this;
@ -2245,7 +2245,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertEquals(request.getHeaders().size(), 0);
}
public class PayloadOptions extends BaseHttpRequestOptions {
public static class PayloadOptions extends BaseHttpRequestOptions {
@Override
public String buildStringPayload() {
return "foo";
@ -2504,7 +2504,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertPayloadEquals(request, "test", "application/unknown", false);
}
public class TestReplaceFormOptions extends BaseHttpRequestOptions {
public static class TestReplaceFormOptions extends BaseHttpRequestOptions {
public TestReplaceFormOptions() {
this.formParameters.put("x-amz-copy-source", "/{bucket}");
}

View File

@ -57,7 +57,7 @@ public class InstanceToNodeMetadataTest {
* The predicates returned always evaluate to true.
*
*/
class FixedGroupNamingConvention implements GroupNamingConvention {
static class FixedGroupNamingConvention implements GroupNamingConvention {
private final String name;
public FixedGroupNamingConvention(final String name) {

View File

@ -168,7 +168,7 @@ public class VirtualGuestToJson implements Binder {
return ImmutableList.copyOf(blockDevices);
}
public class BlockDevicesComparator implements Comparator<BlockDevice> {
public static class BlockDevicesComparator implements Comparator<BlockDevice> {
@Override
public int compare(BlockDevice b1, BlockDevice b2) {

View File

@ -554,7 +554,7 @@ public class SoftLayerComputeServiceAdapter implements
}
}
private class IsOperatingSystem implements Predicate<SoftwareDescription> {
private static class IsOperatingSystem implements Predicate<SoftwareDescription> {
@Override
public boolean apply(SoftwareDescription softwareDescription) {
// operatingSystem is set to '1' if this Software Description describes an Operating System.