Skip to content

Commit f75e734

Browse files
committed
remove noices introduced by wrong line wrapping on comments
1 parent 44e03bf commit f75e734

File tree

2 files changed

+30
-60
lines changed

2 files changed

+30
-60
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/BloomFilter.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,8 @@ private static long getLongLittleEndian(@NonNull byte[] bytes, int offset) {
122122
*/
123123
private int getBitIndex(long hash1, long hash2, int hashIndex) {
124124
// Calculate hashed value h(i) = h1 + (i * h2).
125-
// Even though we are interpreting hash1 and hash2 as unsigned, the addition and
126-
// multiplication
127-
// operators still perform the correct operation and give the desired overflow
128-
// behavior.
125+
// Even though we are interpreting hash1 and hash2 as unsigned, the addition and multiplication
126+
// operators still perform the correct operation and give the desired overflow behavior.
129127
long combinedHash = hash1 + (hash2 * hashIndex);
130128
long modulo = unsignedRemainder(combinedHash, this.bitCount);
131129
return (int) modulo;

firebase-firestore/src/test/java/com/google/firebase/firestore/spec/SpecTestCase.java

Lines changed: 28 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,18 @@ public abstract class SpecTestCase implements RemoteStoreCallback {
143143
// this tag and they'll all be run (but all others won't).
144144
private static final String EXCLUSIVE_TAG = "exclusive";
145145

146-
// The name of a Java system property ({@link System#getProperty(String)}) whose
147-
// value is a filter
148-
// that specifies which tests to execute. The value of this property is a
149-
// regular expression that
150-
// is matched against the name of each test. Using this property is an
151-
// alternative to setting the
152-
// {@link #EXCLUSIVE_TAG} tag, which requires modifying the JSON file. To use
153-
// this property,
154-
// specify -DspecTestFilter=<Regex> to the Java runtime, replacing <Regex> with
155-
// a regular
156-
// expression; a test will be executed if and only if its name matches this
157-
// regular expression.
158-
// In this context, a test's "name" is the result of appending its "itName" to
159-
// its "describeName",
146+
// The name of a Java system property ({@link System#getProperty(String)}) whose value is a filter
147+
// that specifies which tests to execute. The value of this property is a regular expression that
148+
// is matched against the name of each test. Using this property is an alternative to setting the
149+
// {@link #EXCLUSIVE_TAG} tag, which requires modifying the JSON file. To use this property,
150+
// specify -DspecTestFilter=<Regex> to the Java runtime, replacing <Regex> with a regular
151+
// expression; a test will be executed if and only if its name matches this regular expression.
152+
// In this context, a test's "name" is the result of appending its "itName" to its "describeName",
160153
// separated by a space character.
161154
private static final String TEST_FILTER_PROPERTY = "specTestFilter";
162155

163-
// Tags on tests that should be excluded from execution, useful to allow the
164-
// platforms to
165-
// temporarily diverge or for features that are designed to be platform specific
166-
// (such as
156+
// Tags on tests that should be excluded from execution, useful to allow the platforms to
157+
// temporarily diverge or for features that are designed to be platform specific (such as
167158
// 'multi-client').
168159
private static final Set<String> DISABLED_TAGS =
169160
RUN_BENCHMARK_TESTS
@@ -242,8 +233,7 @@ public abstract class SpecTestCase implements RemoteStoreCallback {
242233

243234
public static void info(String line) {
244235
if (DEBUG) {
245-
// Print log information out directly to cut down on logger-related cruft like
246-
// the extra
236+
// Print log information out directly to cut down on logger-related cruft like the extra
247237
// line for the date and class method which are always SpecTestCase+info
248238
System.err.println(line);
249239
} else {
@@ -502,6 +492,7 @@ private BloomFilter parseBloomFilter(JSONObject obj) throws JSONException {
502492
//
503493
// Methods for doing the steps of the spec test.
504494
//
495+
505496
private void doListen(JSONObject listenSpec) throws Exception {
506497
int expectedId = listenSpec.getInt("targetId");
507498
Query query = parseQuery(listenSpec.getJSONObject("query"));
@@ -642,8 +633,7 @@ private void doWatchRemove(JSONObject watchRemoveSpec) throws Exception {
642633
new WatchTargetChange(
643634
WatchTargetChangeType.Removed, targetIds, WatchStream.EMPTY_RESUME_TOKEN, error);
644635
writeWatchChange(change, SnapshotVersion.NONE);
645-
// Unlike web, the MockDatastore detects a watch removal with cause and will
646-
// remove active
636+
// Unlike web, the MockDatastore detects a watch removal with cause and will remove active
647637
// targets
648638
}
649639

@@ -697,7 +687,6 @@ private void doWatchFilter(JSONObject watchFilter) throws Exception {
697687
? parseBloomFilter(watchFilter.getJSONObject("bloomFilter"))
698688
: null;
699689

700-
// TODO: extend this with different existence filters over time.
701690
ExistenceFilter filter = new ExistenceFilter(keyCount, bloomFilterProto);
702691
ExistenceFilterWatchChange change = new ExistenceFilterWatchChange(targets.get(0), filter);
703692
writeWatchChange(change, SnapshotVersion.NONE);
@@ -710,8 +699,7 @@ private void doWatchReset(JSONArray targetIds) throws Exception {
710699
}
711700

712701
private void doWatchSnapshot(JSONObject watchSnapshot) throws Exception {
713-
// The client will only respond to watchSnapshots if they are on a target change
714-
// with an empty
702+
// The client will only respond to watchSnapshots if they are on a target change with an empty
715703
// set of target IDs.
716704
List<Integer> targets =
717705
watchSnapshot.has("targetIds")
@@ -734,8 +722,7 @@ private void doWatchStreamClose(JSONObject spec) throws Exception {
734722
Status status =
735723
Status.fromCodeValue(error.getInt("code")).withDescription(error.getString("message"));
736724
queue.runSync(() -> datastore.failWatchStream(status));
737-
// Unlike web, stream should re-open synchronously (if we have active
738-
// listeners).
725+
// Unlike web, stream should re-open synchronously (if we have active listeners).
739726
if (!this.queryListeners.isEmpty()) {
740727
assertTrue("Watch stream is open", datastore.isWatchStreamOpen());
741728
}
@@ -876,8 +863,7 @@ private void doStep(JSONObject step) throws Exception {
876863
} else if (step.has("watchStreamClose")) {
877864
doWatchStreamClose(step.getJSONObject("watchStreamClose"));
878865
} else if (step.has("watchProto")) {
879-
// watchProto isn't yet used, and it's unclear how to create arbitrary protos
880-
// from JSON.
866+
// watchProto isn't yet used, and it's unclear how to create arbitrary protos from JSON.
881867
throw Assert.fail("watchProto is not yet supported.");
882868
} else if (step.has("writeAck")) {
883869
doWriteAck(step.getJSONObject("writeAck"));
@@ -894,12 +880,9 @@ private void doStep(JSONObject step) throws Exception {
894880
doDisableNetwork();
895881
}
896882
} else if (step.has("changeUser")) {
897-
// NOTE: JSONObject.getString("foo") where "foo" is mapped to null will return
898-
// "null".
899-
// Explicitly testing for isNull here allows the null value to be preserved.
900-
// This is important
901-
// because the unauthenticated user is represented as having a null uid as a
902-
// value for
883+
// NOTE: JSONObject.getString("foo") where "foo" is mapped to null will return "null".
884+
// Explicitly testing for isNull here allows the null value to be preserved. This is important
885+
// because the unauthenticated user is represented as having a null uid as a value for
903886
// "changeUser".
904887
String uid = step.isNull("changeUser") ? null : step.getString("changeUser");
905888
doChangeUser(uid);
@@ -1042,10 +1025,8 @@ private void validateExpectedState(@Nullable JSONObject expectedState) throws JS
10421025
expectedActiveTargets.put(targetId, new ArrayList<>());
10431026
for (int i = 0; i < queryArrayJson.length(); i++) {
10441027
Query query = parseQuery(queryArrayJson.getJSONObject(i));
1045-
// TODO: populate the purpose of the target once it's possible to encode that in
1046-
// the
1047-
// spec tests. For now, hard-code that it's a listen despite the fact that it's
1048-
// not
1028+
// TODO: populate the purpose of the target once it's possible to encode that in the
1029+
// spec tests. For now, hard-code that it's a listen despite the fact that it's not
10491030
// always the right value.
10501031
TargetData targetData =
10511032
new TargetData(
@@ -1075,8 +1056,7 @@ private void validateExpectedState(@Nullable JSONObject expectedState) throws JS
10751056
// Always validate that the expected limbo docs match the actual limbo docs.
10761057
validateActiveLimboDocs();
10771058
validateEnqueuedLimboDocs();
1078-
// Always validate that the expected active targets match the actual active
1079-
// targets.
1059+
// Always validate that the expected active targets match the actual active targets.
10801060
validateActiveTargets();
10811061
}
10821062

@@ -1115,8 +1095,7 @@ private void validateUserCallbacks(@Nullable JSONObject expected) throws JSONExc
11151095
}
11161096

11171097
private void validateActiveLimboDocs() {
1118-
// Make a copy so it can modified while checking against the expected limbo
1119-
// docs.
1098+
// Make a copy so it can modified while checking against the expected limbo docs.
11201099
@SuppressWarnings("VisibleForTests")
11211100
Map<DocumentKey, Integer> actualLimboDocs =
11221101
new HashMap<>(syncEngine.getActiveLimboDocumentResolutions());
@@ -1193,8 +1172,7 @@ private void validateActiveTargets() {
11931172
TargetData expectedTarget = expectedQueries.get(0);
11941173
TargetData actualTarget = actualTargets.get(expected.getKey());
11951174

1196-
// TODO: validate the purpose of the target once it's possible to encode that in
1197-
// the
1175+
// TODO: validate the purpose of the target once it's possible to encode that in the
11981176
// spec tests. For now, only validate properties that can be validated.
11991177
// assertEquals(expectedTarget, actualTarget);
12001178
assertEquals(expectedTarget.getTarget(), actualTarget.getTarget());
@@ -1217,7 +1195,6 @@ private void validateActiveTargets() {
12171195
private void runSteps(JSONArray steps, JSONObject config) throws Exception {
12181196
try {
12191197
specSetUp(config);
1220-
12211198
for (int i = 0; i < steps.length(); ++i) {
12221199
JSONObject step = steps.getJSONObject(i);
12231200
@Nullable JSONArray expectedSnapshotEvents = step.optJSONArray("expectedSnapshotEvents");
@@ -1253,14 +1230,10 @@ private void runSteps(JSONArray steps, JSONObject config) throws Exception {
12531230
} catch (Exception e) {
12541231
throw Assert.fail("Spec test failed with %s", e);
12551232
} finally {
1256-
// Ensure that Persistence is torn down even if the test is failing due to a
1257-
// thrown exception
1258-
// so that any open databases are closed. This is important when the LocalStore
1259-
// is backed by
1260-
// SQLite because SQLite opens databases in exclusive mode. If tearDownForSpec
1261-
// were not called
1262-
// after an exception then subsequent attempts to open the SQLite database will
1263-
// fail, making
1233+
// Ensure that Persistence is torn down even if the test is failing due to a thrown exception
1234+
// so that any open databases are closed. This is important when the LocalStore is backed by
1235+
// SQLite because SQLite opens databases in exclusive mode. If tearDownForSpec were not called
1236+
// after an exception then subsequent attempts to open the SQLite database will fail, making
12641237
// it harder to zero in on the spec tests as a culprit.
12651238
specTearDown();
12661239
}
@@ -1310,8 +1283,7 @@ public void testSpecTests() throws Exception {
13101283
String fileName = parsedSpecFile.first;
13111284
JSONObject fileJSON = parsedSpecFile.second;
13121285

1313-
// Print the names of the files and tests regardless of whether verbose logging
1314-
// is enabled.
1286+
// Print the names of the files and tests regardless of whether verbose logging is enabled.
13151287
info("Spec test file: " + fileName);
13161288

13171289
// Iterate over the tests in the file and run them.

0 commit comments

Comments
 (0)