Upgrade to google-java-format 1.5

Change-Id: Ibad33f7aff0226fa954d44365e2b3ea2e3c6ff8e
This commit is contained in:
David Pursehouse 2018-04-18 09:33:50 +02:00
parent 421930886b
commit c421174abf
18 changed files with 35 additions and 32 deletions

View File

@ -1552,7 +1552,7 @@ public class ChangeIT extends AbstractDaemonTest {
String oldETag = rsrc.getETag(); String oldETag = rsrc.getETag();
Timestamp oldTs = rsrc.getChange().getLastUpdatedOn(); Timestamp oldTs = rsrc.getChange().getLastUpdatedOn();
//create a group named "ab" with one user: testUser // create a group named "ab" with one user: testUser
TestAccount testUser = accountCreator.create("abcd", "abcd@test.com", "abcd"); TestAccount testUser = accountCreator.create("abcd", "abcd@test.com", "abcd");
String testGroup = createGroupWithRealName("ab"); String testGroup = createGroupWithRealName("ab");
GroupApi groupApi = gApi.groups().id(testGroup); GroupApi groupApi = gApi.groups().id(testGroup);
@ -1596,7 +1596,7 @@ public class ChangeIT extends AbstractDaemonTest {
String oldETag = rsrc.getETag(); String oldETag = rsrc.getETag();
Timestamp oldTs = rsrc.getChange().getLastUpdatedOn(); Timestamp oldTs = rsrc.getChange().getLastUpdatedOn();
//create a group named "kobe" with one user: lee // create a group named "kobe" with one user: lee
TestAccount testUser = accountCreator.create("kobebryant", "kobebryant@test.com", "kobebryant"); TestAccount testUser = accountCreator.create("kobebryant", "kobebryant@test.com", "kobebryant");
TestAccount myGroupUser = accountCreator.create("lee", "lee@test.com", "lee"); TestAccount myGroupUser = accountCreator.create("lee", "lee@test.com", "lee");
@ -1605,7 +1605,7 @@ public class ChangeIT extends AbstractDaemonTest {
groupApi.description("test group"); groupApi.description("test group");
groupApi.addMembers(myGroupUser.fullName); groupApi.addMembers(myGroupUser.fullName);
//ensure that user "user" is not in the group // ensure that user "user" is not in the group
groupApi.removeMembers(testUser.fullName); groupApi.removeMembers(testUser.fullName);
AddReviewerInput in = new AddReviewerInput(); AddReviewerInput in = new AddReviewerInput();

View File

@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
public class SshCommandsIT extends AbstractDaemonTest { public class SshCommandsIT extends AbstractDaemonTest {
private static final Logger log = LoggerFactory.getLogger(SshCommandsIT.class); private static final Logger log = LoggerFactory.getLogger(SshCommandsIT.class);
//TODO: It would be better to dynamically generate this list // TODO: It would be better to dynamically generate this list
private static final Map<String, List<String>> COMMANDS = private static final Map<String, List<String>> COMMANDS =
ImmutableMap.of( ImmutableMap.of(
Commands.ROOT, Commands.ROOT,

View File

@ -34,7 +34,7 @@ public class DynamicSetTest {
@Test @Test
public void containsWithEmpty() throws Exception { public void containsWithEmpty() throws Exception {
DynamicSet<Integer> ds = new DynamicSet<>(); DynamicSet<Integer> ds = new DynamicSet<>();
assertThat(ds.contains(2)).isFalse(); //See above comment about ds.contains assertThat(ds.contains(2)).isFalse(); // See above comment about ds.contains
} }
@Test @Test
@ -42,7 +42,7 @@ public class DynamicSetTest {
DynamicSet<Integer> ds = new DynamicSet<>(); DynamicSet<Integer> ds = new DynamicSet<>();
ds.add(2); ds.add(2);
assertThat(ds.contains(2)).isTrue(); //See above comment about ds.contains assertThat(ds.contains(2)).isTrue(); // See above comment about ds.contains
} }
@Test @Test
@ -50,7 +50,7 @@ public class DynamicSetTest {
DynamicSet<Integer> ds = new DynamicSet<>(); DynamicSet<Integer> ds = new DynamicSet<>();
ds.add(2); ds.add(2);
assertThat(ds.contains(3)).isFalse(); //See above comment about ds.contains assertThat(ds.contains(3)).isFalse(); // See above comment about ds.contains
} }
@Test @Test
@ -59,7 +59,7 @@ public class DynamicSetTest {
ds.add(2); ds.add(2);
ds.add(4); ds.add(4);
assertThat(ds.contains(4)).isTrue(); //See above comment about ds.contains assertThat(ds.contains(4)).isTrue(); // See above comment about ds.contains
} }
@Test @Test
@ -68,7 +68,7 @@ public class DynamicSetTest {
ds.add(2); ds.add(2);
ds.add(4); ds.add(4);
assertThat(ds.contains(3)).isFalse(); //See above comment about ds.contains assertThat(ds.contains(3)).isFalse(); // See above comment about ds.contains
} }
@Test @Test
@ -82,12 +82,12 @@ public class DynamicSetTest {
ds.add(6); ds.add(6);
// At first, 4 is contained. // At first, 4 is contained.
assertThat(ds.contains(4)).isTrue(); //See above comment about ds.contains assertThat(ds.contains(4)).isTrue(); // See above comment about ds.contains
// Then we remove 4. // Then we remove 4.
handle.remove(); handle.remove();
// And now 4 should no longer be contained. // And now 4 should no longer be contained.
assertThat(ds.contains(4)).isFalse(); //See above comment about ds.contains assertThat(ds.contains(4)).isFalse(); // See above comment about ds.contains
} }
} }

View File

@ -75,8 +75,8 @@ public class StaticModule extends ServletModule {
ImmutableList.of("/", "/c/*", "/q/*", "/x/*", "/admin/*", "/dashboard/*", "/settings/*"); ImmutableList.of("/", "/c/*", "/q/*", "/x/*", "/admin/*", "/dashboard/*", "/settings/*");
// TODO(dborowitz): These fragments conflict with the REST API // TODO(dborowitz): These fragments conflict with the REST API
// namespace, so they will need to use a different path. // namespace, so they will need to use a different path.
//"/groups/*", // "/groups/*",
//"/projects/*"); // "/projects/*");
// //
/** /**

View File

@ -60,7 +60,7 @@ public class LogFileCompressor implements Runnable {
@Override @Override
public void start() { public void start() {
//compress log once and then schedule compression every day at 11:00pm // compress log once and then schedule compression every day at 11:00pm
queue.getDefaultQueue().execute(compressor); queue.getDefaultQueue().execute(compressor);
ZoneId zone = ZoneId.systemDefault(); ZoneId zone = ZoneId.systemDefault();
LocalDateTime now = LocalDateTime.now(zone); LocalDateTime now = LocalDateTime.now(zone);

View File

@ -58,7 +58,7 @@ public class StoredValue<T> {
public T get(Prolog engine) { public T get(Prolog engine) {
T obj = getOrNull(engine); T obj = getOrNull(engine);
if (obj == null) { if (obj == null) {
//unless createValue() is overridden, will return null // unless createValue() is overridden, will return null
obj = createValue(engine); obj = createValue(engine);
if (obj == null) { if (obj == null) {
throw new SystemException("No " + key + " available"); throw new SystemException("No " + key + " available");

View File

@ -142,7 +142,8 @@ public class AccountManager {
ExternalId.Key key = ExternalId.Key.create(SCHEME_USERNAME, who.getUserName()); ExternalId.Key key = ExternalId.Key.create(SCHEME_USERNAME, who.getUserName());
ExternalId existingId = externalIds.get(key); ExternalId existingId = externalIds.get(key);
if (existingId != null) { if (existingId != null) {
// An inconsistency is detected in the database, having a record for scheme "username:" // An inconsistency is detected in the database, having a record for scheme
// "username:"
// but no record for scheme "gerrit:". Try to recover by linking // but no record for scheme "gerrit:". Try to recover by linking
// "gerrit:" identity to the existing account. // "gerrit:" identity to the existing account.
log.warn( log.warn(

View File

@ -86,7 +86,8 @@ public class SuggestChangeReviewers extends SuggestReviewers
private VisibilityControl getVisibility(ChangeResource rsrc) { private VisibilityControl getVisibility(ChangeResource rsrc) {
// Use the destination reference, not the change, as drafts may deny // Use the destination reference, not the change, as drafts may deny
// anyone who is not already a reviewer. // anyone who is not already a reviewer.
// TODO(hiesel) Replace this with a check on the change resource once support for drafts was removed // TODO(hiesel) Replace this with a check on the change resource once support for drafts was
// removed
PermissionBackend.ForRef perm = permissionBackend.user(self).ref(rsrc.getChange().getDest()); PermissionBackend.ForRef perm = permissionBackend.user(self).ref(rsrc.getChange().getDest());
return new VisibilityControl() { return new VisibilityControl() {
@Override @Override

View File

@ -104,7 +104,7 @@ public class ProjectConfigEntry {
this(displayName, defaultValue, null); this(displayName, defaultValue, null);
} }
//For inheritable boolean use 'LIST' type with InheritableBoolean // For inheritable boolean use 'LIST' type with InheritableBoolean
public ProjectConfigEntry(String displayName, boolean defaultValue, String description) { public ProjectConfigEntry(String displayName, boolean defaultValue, String description) {
this( this(
displayName, displayName,

View File

@ -2938,7 +2938,7 @@ class ReceiveCommits {
try { try {
r.put(cd.change().getKey(), cd.notes()); r.put(cd.change().getKey(), cd.notes());
} catch (NoSuchChangeException e) { } catch (NoSuchChangeException e) {
//Ignore deleted change // Ignore deleted change
} }
} }
return r; return r;

View File

@ -268,7 +268,7 @@ public class ChangeNotesCache {
+ P + P
+ ident // author + ident // author
+ P + P
+ ident //realAuthor + ident // realAuthor
+ P + P
+ T // writtenOn + T // writtenOn
+ 2 // side + 2 // side

View File

@ -41,7 +41,8 @@ class MySql extends BaseDataSourceType {
b.append(port(dbs.optional("port"))); b.append(port(dbs.optional("port")));
b.append("/"); b.append("/");
b.append(dbs.required("database")); b.append(dbs.required("database"));
// See https://stackoverflow.com/questions/42084633/table-name-pattern-can-not-be-null-or-empty-in-java // See
// https://stackoverflow.com/questions/42084633/table-name-pattern-can-not-be-null-or-empty-in-java
b.append("?nullNamePatternMatchesAll=true"); b.append("?nullNamePatternMatchesAll=true");
return b.toString(); return b.toString();
} }

View File

@ -66,7 +66,8 @@ public class Schema_105 extends SchemaVersion {
private Set<String> listChangesIndexes(JdbcSchema schema) throws SQLException { private Set<String> listChangesIndexes(JdbcSchema schema) throws SQLException {
// List of all changes indexes ever created or dropped, found with the // List of all changes indexes ever created or dropped, found with the
// following command: // following command:
// find g* -name \*.sql | xargs git log -i -p -S' index changes_' | grep -io ' index changes_\w*' | cut -d' ' -f3 | tr A-Z a-z | sort -u // find g* -name \*.sql | xargs git log -i -p -S' index changes_' | grep -io ' index
// changes_\w*' | cut -d' ' -f3 | tr A-Z a-z | sort -u
// Used rather than listIndexes as we're not sure whether it might include // Used rather than listIndexes as we're not sure whether it might include
// primary key indexes. // primary key indexes.
Set<String> allChanges = Set<String> allChanges =

View File

@ -34,6 +34,6 @@ public interface RepoOnlyOp {
* *
* @param ctx context * @param ctx context
*/ */
//TODO(dborowitz): Support async operations? // TODO(dborowitz): Support async operations?
default void postUpdate(Context ctx) throws Exception {} default void postUpdate(Context ctx) throws Exception {}
} }

View File

@ -77,14 +77,14 @@ public class IntraLineLoaderTest {
String b = "multi\nlinemulti\nline\n"; String b = "multi\nlinemulti\nline\n";
assertThat(intraline(a, b)).isEqualTo(wordEdit(10, 10, 6, 16)); assertThat(intraline(a, b)).isEqualTo(wordEdit(10, 10, 6, 16));
// better would be: // better would be:
//assertThat(intraline(a, b)).isEqualTo(wordEdit(6, 6, 6, 16)); // assertThat(intraline(a, b)).isEqualTo(wordEdit(6, 6, 6, 16));
// or the equivalent: // or the equivalent:
//assertThat(intraline(a, b)).isEqualTo(ref() // assertThat(intraline(a, b)).isEqualTo(ref()
// .common("multi\n").insert("linemulti\n").common("line\n").edits // .common("multi\n").insert("linemulti\n").common("line\n").edits
//); // );
} }
//TODO: expected failure // TODO: expected failure
// the current code does not work on the first line // the current code does not work on the first line
// and the insert marker is in the wrong location // and the insert marker is in the wrong location
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
@ -95,7 +95,7 @@ public class IntraLineLoaderTest {
.isEqualTo(ref().insert(" ").common(" abc\n").insert(" ").common(" def\n").edits); .isEqualTo(ref().insert(" ").common(" abc\n").insert(" ").common(" def\n").edits);
} }
//TODO: expected failure // TODO: expected failure
// the current code does not work on the first line // the current code does not work on the first line
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void preferDeleteAtLineBreak() throws Exception { public void preferDeleteAtLineBreak() throws Exception {

View File

@ -202,7 +202,7 @@ public class InMemoryModule extends FactoryModule {
return CanonicalWebUrlProvider.class; return CanonicalWebUrlProvider.class;
} }
}); });
//Replacement of DiffExecutorModule to not use thread pool in the tests // Replacement of DiffExecutorModule to not use thread pool in the tests
install( install(
new AbstractModule() { new AbstractModule() {
@Override @Override

View File

@ -66,8 +66,7 @@ public class SetLoggingLevelCommand extends SshCommand {
reset(); reset();
} else { } else {
for (Enumeration<Logger> logger = LogManager.getCurrentLoggers(); for (Enumeration<Logger> logger = LogManager.getCurrentLoggers();
logger.hasMoreElements(); logger.hasMoreElements(); ) {
) {
Logger log = logger.nextElement(); Logger log = logger.nextElement();
if (name == null || log.getName().contains(name)) { if (name == null || log.getName().contains(name)) {
log.setLevel(Level.toLevel(level.name())); log.setLevel(Level.toLevel(level.name()));

View File

@ -17,7 +17,7 @@
set -eu set -eu
# Keep this version in sync with dev-contributing.txt. # Keep this version in sync with dev-contributing.txt.
VERSION=${1:-1.3} VERSION=${1:-1.5}
case "$VERSION" in case "$VERSION" in
1.3) 1.3)