Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JDK 21 lint warnings #112249

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public static class Request extends MasterNodeReadRequest<Request> {

private final EnumSet<Metric> metrics;

@SuppressWarnings("this-escape")
public Request(TimeValue masterNodeTimeout, TaskId parentTaskId, EnumSet<Metric> metrics) {
super(masterNodeTimeout);
setParentTask(parentTaskId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ public ResolveClusterActionRequest(String[] names) {
this(names, DEFAULT_INDICES_OPTIONS);
}

@SuppressWarnings("this-escape")
public ResolveClusterActionRequest(String[] names, IndicesOptions indicesOptions) {
this.names = names;
this.localIndicesRequested = localIndicesPresent(names);
this.indicesOptions = indicesOptions;
}

@SuppressWarnings("this-escape")
public ResolveClusterActionRequest(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().before(TransportVersions.V_8_13_0)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class DeleteRequestBuilder extends ReplicationRequestBuilder<DeleteReques
private Long term;
private WriteRequest.RefreshPolicy refreshPolicy;

@SuppressWarnings("this-escape")
public DeleteRequestBuilder(ElasticsearchClient client, @Nullable String index) {
super(client, TransportDeleteAction.TYPE);
setIndex(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public IndexRequestBuilder(ElasticsearchClient client) {
this(client, null);
}

@SuppressWarnings("this-escape")
public IndexRequestBuilder(ElasticsearchClient client, @Nullable String index) {
super(client, TransportIndexAction.TYPE);
setIndex(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public UpdateRequestBuilder(ElasticsearchClient client) {
this(client, null, null);
}

@SuppressWarnings("this-escape")
public UpdateRequestBuilder(ElasticsearchClient client, String index, String id) {
super(client, TransportUpdateAction.TYPE);
setIndex(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public abstract class AbstractClient implements Client {
private final ThreadPool threadPool;
private final AdminClient admin;

@SuppressWarnings("this-escape")
public AbstractClient(Settings settings, ThreadPool threadPool) {
this.settings = settings;
this.threadPool = threadPool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public static class DeduplicateFieldInfosCodec extends FilterCodec {

private final DeduplicatingFieldInfosFormat deduplicatingFieldInfosFormat;

@SuppressWarnings("this-escape")
protected DeduplicateFieldInfosCodec(String name, Codec delegate) {
super(name, delegate);
this.deduplicatingFieldInfosFormat = new DeduplicatingFieldInfosFormat(super.fieldInfosFormat());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public abstract static class Builder {

private String leafName;

@SuppressWarnings("this-escape")
protected Builder(String leafName) {
setLeafName(leafName);
}
Expand Down Expand Up @@ -55,6 +56,7 @@ default boolean supportsVersion(IndexVersion indexCreatedVersion) {

private final String leafName;

@SuppressWarnings("this-escape")
public Mapper(String leafName) {
Objects.requireNonNull(leafName);
this.leafName = internFieldName(leafName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public DeleteByQueryRequestBuilder(ElasticsearchClient client) {
this(client, new SearchRequestBuilder(client));
}

@SuppressWarnings("this-escape")
private DeleteByQueryRequestBuilder(ElasticsearchClient client, SearchRequestBuilder search) {
super(client, DeleteByQueryAction.INSTANCE, search);
source().setFetchSource(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static boolean hasMetric(String name) {
protected final double max;
protected final double sum;

@SuppressWarnings("this-escape")
public InternalStats(
String name,
long count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ public class RankFeatureResult extends SearchPhaseResult {

public RankFeatureResult() {}

@SuppressWarnings("this-escape")
public RankFeatureResult(ShardSearchContextId id, SearchShardTarget shardTarget, ShardSearchRequest request) {
this.contextId = id;
setSearchShardTarget(shardTarget);
setShardSearchRequest(request);
}

@SuppressWarnings("this-escape")
public RankFeatureResult(StreamInput in) throws IOException {
super(in);
contextId = new ShardSearchContextId(in);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public void collect(int doc, long bucket) throws IOException {
}
assertEquals(size, Math.min(queue.size(), expected.length - pos));
int ptr = pos + ((int) queue.size() - 1);
pos += queue.size();
pos += Math.toIntExact(queue.size());
last = null;
while (queue.size() > pos) {
CompositeKey key = queue.toCompositeKey(queue.pop());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ protected int computeCacheFileRegionSize(long fileLength, int region) {
final var blobLength = randomLongBetween(1L, cacheSize);

int regions = Math.toIntExact(blobLength / regionSize);
regions += (blobLength % regionSize == 0L ? 0L : 1L);
regions += (blobLength % regionSize == 0 ? 0 : 1);
assertThat(
cacheService.computeCacheFileRegionSize(blobLength, randomFrom(regions)),
equalTo(BlobCacheUtils.toIntBytes(regionSize))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public abstract class YamlTemplateRegistry extends IndexTemplateRegistry {
private final FeatureService featureService;
private volatile boolean enabled;

@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "this-escape" })
public YamlTemplateRegistry(
Settings nodeSettings,
ClusterService clusterService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public class EsqlFunctionRegistry {

private SnapshotFunctionRegistry snapshotRegistry = null;

@SuppressWarnings("this-escape")
public EsqlFunctionRegistry() {
register(functions());
buildDataTypesForStringLiteralConversion(functions());
Expand Down