Skip to content

Commit 1722c0a

Browse files
authored
Suppress this-escape warning for JDK21 (#101519)
* Suppress this-escape warning for JDK21 * add suppression to all ctors in esql Lexer & Parser
1 parent 3a087e4 commit 1722c0a

File tree

11 files changed

+112
-0
lines changed

11 files changed

+112
-0
lines changed

modules/apm/src/main/java/org/elasticsearch/telemetry/apm/AbstractInstrument.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public abstract class AbstractInstrument<T> implements Instrument {
3030
private final String description;
3131
private final String unit;
3232

33+
@SuppressWarnings("this-escape")
3334
public AbstractInstrument(Meter meter, String name, String description, String unit) {
3435
this.name = Objects.requireNonNull(name);
3536
this.description = Objects.requireNonNull(description);

server/src/main/java/org/elasticsearch/action/search/SearchResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ public Clusters(int total, int successful, int skipped) {
538538
this.clusterInfo = Collections.emptyMap(); // will never be used if created from this constructor
539539
}
540540

541+
@SuppressWarnings("this-escape")
541542
public Clusters(StreamInput in) throws IOException {
542543
this.total = in.readVInt();
543544
int successfulTemp = in.readVInt();

server/src/main/java/org/elasticsearch/action/support/HandledTransportAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ protected HandledTransportAction(
3131
this(actionName, true, transportService, actionFilters, requestReader, executor);
3232
}
3333

34+
@SuppressWarnings("this-escape")
3435
protected HandledTransportAction(
3536
String actionName,
3637
boolean canTripCircuitBreaker,

server/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ protected TransportNodesAction(
8787
* @deprecated Use the local-only constructor instead.
8888
*/
8989
@Deprecated(forRemoval = true)
90+
@SuppressWarnings("this-escape")
9091
protected TransportNodesAction(
9192
String actionName,
9293
ThreadPool threadPool,

x-pack/plugin/esql/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,23 @@ tasks.register("regen") {
197197
ant.replaceregexp(match: '\t', flags: 'g', replace: ' ', encoding: 'UTF-8') {
198198
fileset(dir: outputPath, includes: 'EsqlBase*.java')
199199
}
200+
// suppress this-escape warnings on EsqlBaseLexer
201+
ant.replaceregexp(
202+
match: 'public EsqlBaseLexer',
203+
replace: '@SuppressWarnings("this-escape")${line.separator} public EsqlBaseLexer',
204+
encoding: 'UTF-8'
205+
) {
206+
fileset(dir: outputPath, includes: 'EsqlBaseLexer.java')
207+
}
208+
// suppress this-escape warnings on all internal EsqlBaseParser class constructores
209+
ant.replaceregexp(
210+
match: '([ ]+)public ([A-Z][a-z]+[a-z,A-Z]+\\()',
211+
flags: 'g',
212+
replace: '\\1@SuppressWarnings("this-escape")${line.separator}\\1public \\2',
213+
encoding: 'UTF-8'
214+
) {
215+
fileset(dir: outputPath, includes: 'EsqlBaseParser.java')
216+
}
200217
// fix line endings
201218
ant.fixcrlf(srcdir: outputPath, eol: 'lf') {
202219
patternset(includes: 'EsqlBase*.java')

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/DocVector.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class DocVector extends AbstractVector implements Vector {
4848

4949
final DocBlock block;
5050

51+
@SuppressWarnings("this-escape")
5152
public DocVector(IntVector shards, IntVector segments, IntVector docs, Boolean singleSegmentNonDecreasing) {
5253
super(shards.getPositionCount(), null);
5354
this.shards = shards;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public Vocabulary getVocabulary() {
127127
}
128128

129129

130+
@SuppressWarnings("this-escape")
130131
public EsqlBaseLexer(CharStream input) {
131132
super(input);
132133
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);

0 commit comments

Comments
 (0)