Skip to content

Commit

Permalink
Update spotless to 5.9.0 (#67698)
Browse files Browse the repository at this point in the history
This brings in the assertion formatting changes that we contributed
upstream, which resulted in a number of assertions being reformatted.
  • Loading branch information
pugnascotia committed Jan 20, 2021
1 parent bd08e19 commit 961d35c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ plugins {
id 'lifecycle-base'
id 'elasticsearch.docker-support'
id 'elasticsearch.global-build-info'
id "com.diffplug.spotless" version "5.6.1" apply false
id "com.diffplug.spotless" version "5.9.0" apply false
}

apply from: 'gradle/build-scan.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,8 @@ public static class Request extends SingleShardRequest<Request> {
public Request(MultiSearchRequest multiSearchRequest) {
super(multiSearchRequest.requests().get(0).indices()[0]);
this.multiSearchRequest = multiSearchRequest;
assert multiSearchRequest.requests()
.stream()
.map(SearchRequest::indices)
.flatMap(Arrays::stream)
.distinct()
.count() == 1 : "action [" + NAME + "] cannot handle msearch request pointing to multiple indices";
assert multiSearchRequest.requests().stream().map(SearchRequest::indices).flatMap(Arrays::stream).distinct().count() == 1
: "action [" + NAME + "] cannot handle msearch request pointing to multiple indices";
assert assertSearchSource();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ public BaseSearchableSnapshotIndexInput(
this.blobContainer = Objects.requireNonNull(blobContainer);
this.fileInfo = Objects.requireNonNull(fileInfo);
this.context = Objects.requireNonNull(context);
assert fileInfo.metadata()
.hashEqualsContents() == false : "this method should only be used with blobs that are NOT stored in metadata's hash field "
+ "(fileInfo: "
+ fileInfo
+ ')';
assert fileInfo.metadata().hashEqualsContents() == false
: "this method should only be used with blobs that are NOT stored in metadata's hash field " + "(fileInfo: " + fileInfo + ')';
this.stats = Objects.requireNonNull(stats);
this.offset = offset;
this.length = length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ private FileChannelReference acquireFileChannelReference() {
synchronized (listeners) {
ensureOpen();
reference = channelRef;
assert reference != null
&& reference.refCount() > 0 : "impossible to run into a fully released channel reference under the listeners mutex";
assert reference != null && reference.refCount() > 0
: "impossible to run into a fully released channel reference under the listeners mutex";
assert refCounter.refCount() > 0 : "file should not be fully released";
reference.incRef();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ private static void ensureSnapshotIsLoaded(IndexShard indexShard) {
});
}
assert directory.listAll().length > 0 : "expecting directory listing to be non-empty";
assert success
|| indexShard.routingEntry()
.recoverySource()
.getType() == RecoverySource.Type.PEER : "loading snapshot must not be called twice unless we are retrying a peer recovery";
assert success || indexShard.routingEntry().recoverySource().getType() == RecoverySource.Type.PEER
: "loading snapshot must not be called twice unless we are retrying a peer recovery";
}

private static void associateNewEmptyTranslogWithIndex(IndexShard indexShard) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,8 @@ boolean matches(CacheKey cacheKey) {

private static boolean assertGenericThreadPool() {
final String threadName = Thread.currentThread().getName();
assert threadName.contains('[' + ThreadPool.Names.GENERIC + ']')
|| threadName.startsWith("TEST-") : "expected generic thread pool but got " + threadName;
assert threadName.contains('[' + ThreadPool.Names.GENERIC + ']') || threadName.startsWith("TEST-")
: "expected generic thread pool but got " + threadName;
return true;
}
}

0 comments on commit 961d35c

Please sign in to comment.