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
@@ -30,7 +30,6 @@ import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -42,9 +41,7 @@ public class GetExternalIds implements RestReadView<AccountResource> {
|
||||
private final AuthConfig authConfig;
|
||||
|
||||
@Inject
|
||||
GetExternalIds(Provider<ReviewDb> db,
|
||||
Provider<CurrentUser> self,
|
||||
AuthConfig authConfig) {
|
||||
GetExternalIds(Provider<ReviewDb> db, Provider<CurrentUser> self, AuthConfig authConfig) {
|
||||
this.db = db;
|
||||
this.self = self;
|
||||
this.authConfig = authConfig;
|
||||
@@ -57,27 +54,23 @@ public class GetExternalIds implements RestReadView<AccountResource> {
|
||||
throw new AuthException("not allowed to get external IDs");
|
||||
}
|
||||
|
||||
Collection<AccountExternalId> ids = db.get().accountExternalIds()
|
||||
.byAccount(resource.getUser().getAccountId()).toList();
|
||||
Collection<AccountExternalId> ids =
|
||||
db.get().accountExternalIds().byAccount(resource.getUser().getAccountId()).toList();
|
||||
if (ids.isEmpty()) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
List<AccountExternalIdInfo> result =
|
||||
Lists.newArrayListWithCapacity(ids.size());
|
||||
List<AccountExternalIdInfo> result = Lists.newArrayListWithCapacity(ids.size());
|
||||
for (AccountExternalId id : ids) {
|
||||
AccountExternalIdInfo info = new AccountExternalIdInfo();
|
||||
info.identity = id.getExternalId();
|
||||
info.emailAddress = id.getEmailAddress();
|
||||
info.trusted =
|
||||
toBoolean(authConfig.isIdentityTrustable(Collections.singleton(id)));
|
||||
info.trusted = toBoolean(authConfig.isIdentityTrustable(Collections.singleton(id)));
|
||||
// The identity can be deleted only if its not the one used to
|
||||
// establish this web session, and if only if an identity was
|
||||
// actually used to establish this web session.
|
||||
if (!id.isScheme(SCHEME_USERNAME)) {
|
||||
AccountExternalId.Key last = resource.getUser()
|
||||
.getLastLoginExternalIdKey();
|
||||
info.canDelete =
|
||||
toBoolean(last == null || !last.get().equals(info.identity));
|
||||
AccountExternalId.Key last = resource.getUser().getLastLoginExternalIdKey();
|
||||
info.canDelete = toBoolean(last == null || !last.get().equals(info.identity));
|
||||
}
|
||||
result.add(info);
|
||||
}
|
||||
@@ -88,4 +81,3 @@ public class GetExternalIds implements RestReadView<AccountResource> {
|
||||
return v ? v : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user