Format all Java files with google-java-format
Having a standard tool for formatting saves reviewers' valuable time. google-java-format is Google's standard formatter and is somewhat inspired by gofmt[1]. This commit formats everything using google-java-format version 1.2. The downside of this one-off formatting is breaking blame. This can be somewhat hacked around with a tool like git-hyper-blame[2], but it's definitely not optimal until/unless this kind of feature makes its way to git core. Not in this change: * Tool support, e.g. Eclipse. The command must be run manually [3]. * Documentation of best practice, e.g. new 100-column default. [1] https://talks.golang.org/2015/gofmt-en.slide#3 [2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html [3] git ls-files | grep java$ | xargs google-java-format -i Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3 Signed-off-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
committed by
David Pursehouse
parent
6723b6d0fa
commit
292fa154c1
@@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.server.ssh;
|
||||
|
||||
import com.jcraft.jsch.HostKey;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -34,12 +34,10 @@ public class NoSshKeyCache implements SshKeyCache, SshKeyCreator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(String username) {
|
||||
}
|
||||
public void evict(String username) {}
|
||||
|
||||
@Override
|
||||
public AccountSshKey create(AccountSshKey.Id id, String encoded)
|
||||
throws InvalidSshKeyException {
|
||||
public AccountSshKey create(AccountSshKey.Id id, String encoded) throws InvalidSshKeyException {
|
||||
throw new InvalidSshKeyException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ package com.google.gerrit.server.ssh;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
/**
|
||||
* Disables the SSH support by stubbing out relevant objects.
|
||||
*/
|
||||
/** Disables the SSH support by stubbing out relevant objects. */
|
||||
public class NoSshModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
|
||||
@@ -20,27 +20,23 @@ import com.google.gerrit.server.util.SocketUtil;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SshAddressesModule extends AbstractModule {
|
||||
private static final Logger log =
|
||||
LoggerFactory.getLogger(SshAddressesModule.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(SshAddressesModule.class);
|
||||
|
||||
public static final int DEFAULT_PORT = 29418;
|
||||
public static final int IANA_SSH_PORT = 22;
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
protected void configure() {}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@@ -76,8 +72,8 @@ public class SshAddressesModule extends AbstractModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
@SshAdvertisedAddresses
|
||||
List<String> getAdvertisedAddresses(@GerritServerConfig Config cfg,
|
||||
@SshListenAddresses List<SocketAddress> listen) {
|
||||
List<String> getAdvertisedAddresses(
|
||||
@GerritServerConfig Config cfg, @SshListenAddresses List<SocketAddress> listen) {
|
||||
String[] want = cfg.getStringList("sshd", null, "advertisedaddress");
|
||||
if (want.length > 0) {
|
||||
return Arrays.asList(want);
|
||||
|
||||
@@ -17,14 +17,11 @@ package com.google.gerrit.server.ssh;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
/**
|
||||
* Marker on the list of {@link java.net.SocketAddress}es configured to be
|
||||
* advertised by the server.
|
||||
* Marker on the list of {@link java.net.SocketAddress}es configured to be advertised by the server.
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface SshAdvertisedAddresses {
|
||||
}
|
||||
public @interface SshAdvertisedAddresses {}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.server.ssh;
|
||||
|
||||
import com.jcraft.jsch.HostKey;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SshInfo {
|
||||
|
||||
@@ -18,6 +18,5 @@ import com.google.gerrit.common.errors.InvalidSshKeyException;
|
||||
import com.google.gerrit.reviewdb.client.AccountSshKey;
|
||||
|
||||
public interface SshKeyCreator {
|
||||
AccountSshKey create(AccountSshKey.Id id, String encoded)
|
||||
throws InvalidSshKeyException;
|
||||
AccountSshKey create(AccountSshKey.Id id, String encoded) throws InvalidSshKeyException;
|
||||
}
|
||||
|
||||
@@ -17,14 +17,12 @@ package com.google.gerrit.server.ssh;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
/**
|
||||
* Marker on the list of {@link java.net.SocketAddress}es on which the SSH
|
||||
* daemon is configured to listen.
|
||||
* Marker on the list of {@link java.net.SocketAddress}es on which the SSH daemon is configured to
|
||||
* listen.
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface SshListenAddresses {
|
||||
}
|
||||
public @interface SshListenAddresses {}
|
||||
|
||||
Reference in New Issue
Block a user