Skip to content

Commit 1e7f6df

Browse files
authored
Support JDK-23 (build time and runtime) (#16257)
Signed-off-by: Andriy Redko <[email protected]>
1 parent 942765e commit 1e7f6df

File tree

14 files changed

+25
-26
lines changed

14 files changed

+25
-26
lines changed

.github/workflows/precommit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
java: [ 11, 17, 21 ]
10+
java: [ 11, 17, 21, 23 ]
1111
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
1212
steps:
1313
- uses: actions/checkout@v4

buildSrc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ dependencies {
114114
api 'com.github.johnrengelman:shadow:8.1.1'
115115
api 'org.jdom:jdom2:2.0.6.1'
116116
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${props.getProperty('kotlin')}"
117-
api 'de.thetaphi:forbiddenapis:3.6'
117+
api 'de.thetaphi:forbiddenapis:3.8'
118118
api 'com.avast.gradle:gradle-docker-compose-plugin:0.17.6'
119119
api "org.yaml:snakeyaml:${props.getProperty('snakeyaml')}"
120120
api 'org.apache.maven:maven-model:3.9.6'

buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditPrecommitPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin {
5151
public TaskProvider<? extends Task> createTask(Project project) {
5252
project.getPlugins().apply(CompileOnlyResolvePlugin.class);
5353
project.getConfigurations().create("forbiddenApisCliJar");
54-
project.getDependencies().add("forbiddenApisCliJar", "de.thetaphi:forbiddenapis:3.5.1");
54+
project.getDependencies().add("forbiddenApisCliJar", "de.thetaphi:forbiddenapis:3.8");
5555

5656
Configuration jdkJarHellConfig = project.getConfigurations().create(JDK_JAR_HELL_CONFIG_NAME);
5757
if (BuildParams.isInternal() && project.getPath().equals(":libs:opensearch-core") == false) {

buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@
7777
import java.util.stream.Stream;
7878

7979
public class DistroTestPlugin implements Plugin<Project> {
80-
private static final String SYSTEM_JDK_VERSION = "21.0.4+7";
80+
private static final String SYSTEM_JDK_VERSION = "23+37";
8181
private static final String SYSTEM_JDK_VENDOR = "adoptium";
82-
private static final String GRADLE_JDK_VERSION = "21.0.4+7";
82+
private static final String GRADLE_JDK_VERSION = "23+37";
8383
private static final String GRADLE_JDK_VENDOR = "adoptium";
8484

8585
// all distributions used by distro tests. this is temporary until tests are per distribution

buildSrc/version.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ opensearch = 3.0.0
22
lucene = 9.12.0
33

44
bundled_jdk_vendor = adoptium
5-
bundled_jdk = 21.0.4+7
5+
bundled_jdk = 23+37
66

77
# optional dependencies
88
spatial4j = 0.7
@@ -60,9 +60,9 @@ bouncycastle=1.78
6060
randomizedrunner = 2.7.1
6161
junit = 4.13.2
6262
hamcrest = 2.1
63-
mockito = 5.12.0
63+
mockito = 5.14.1
6464
objenesis = 3.2
65-
bytebuddy = 1.14.9
65+
bytebuddy = 1.15.4
6666

6767
# benchmark dependencies
6868
jmh = 1.35

gradle/code-coverage.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repositories {
1919

2020
allprojects {
2121
plugins.withId('jacoco') {
22-
jacoco.toolVersion = '0.8.10'
22+
jacoco.toolVersion = '0.8.12'
2323
}
2424
}
2525

libs/grok/src/main/java/org/opensearch/grok/GrokCaptureConfig.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public GrokCaptureExtracter forBoolean(Function<Consumer<Boolean>, GrokCaptureEx
114114
/**
115115
* Build an extract that has access to the "native" type of the extracter
116116
* match. This means that patterns like {@code %{NUMBER:bytes:float}} has
117-
* access to an actual {@link float}. Extracters returned from this method
118-
* should be stateless stateless and can be reused. Pathological implementations
117+
* access to an actual float. Extracters returned from this method
118+
* should be stateless and can be reused. Pathological implementations
119119
* of the {@code map} parameter could violate this, but the caller should
120120
* take care to stay sane.
121121
* <p>
@@ -144,27 +144,27 @@ public interface NativeExtracterMap<T> {
144144
T forString(Function<Consumer<String>, GrokCaptureExtracter> buildExtracter);
145145

146146
/**
147-
* Called when the native type is an {@link int}.
147+
* Called when the native type is an int.
148148
*/
149149
T forInt(Function<IntConsumer, GrokCaptureExtracter> buildExtracter);
150150

151151
/**
152-
* Called when the native type is an {@link long}.
152+
* Called when the native type is an long.
153153
*/
154154
T forLong(Function<LongConsumer, GrokCaptureExtracter> buildExtracter);
155155

156156
/**
157-
* Called when the native type is an {@link float}.
157+
* Called when the native type is an float.
158158
*/
159159
T forFloat(Function<FloatConsumer, GrokCaptureExtracter> buildExtracter);
160160

161161
/**
162-
* Called when the native type is an {@link double}.
162+
* Called when the native type is an double.
163163
*/
164164
T forDouble(Function<DoubleConsumer, GrokCaptureExtracter> buildExtracter);
165165

166166
/**
167-
* Called when the native type is an {@link boolean}.
167+
* Called when the native type is an boolean.
168168
*/
169169
T forBoolean(Function<Consumer<Boolean>, GrokCaptureExtracter> buildExtracter);
170170
}

plugins/discovery-ec2/src/test/java/org/opensearch/discovery/ec2/Ec2DiscoveryTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ protected List<TransportAddress> buildDynamicHosts(Settings nodeSettings, int no
175175
exchange.getResponseHeaders().set("Content-Type", "text/xml; charset=UTF-8");
176176
exchange.sendResponseHeaders(HttpStatus.SC_OK, responseBody.length);
177177
exchange.getResponseBody().write(responseBody);
178+
exchange.getResponseBody().flush();
178179
return;
179180
}
180181
}

plugins/discovery-ec2/src/test/java/org/opensearch/discovery/ec2/Ec2RetriesTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public void testEC2DiscoveryRetriesOnRateLimiting() throws IOException {
125125
exchange.getResponseHeaders().set("Content-Type", "text/xml; charset=UTF-8");
126126
exchange.sendResponseHeaders(HttpStatus.SC_OK, responseBody.length);
127127
exchange.getResponseBody().write(responseBody);
128+
exchange.getResponseBody().flush();
128129
return;
129130
}
130131
}

plugins/repository-hdfs/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ for (String fixtureName : ['hdfsFixture', 'haHdfsFixture', 'secureHdfsFixture',
146146
}
147147
final List<String> miniHDFSArgs = []
148148

149+
if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_23) {
150+
miniHDFSArgs.add('-Djava.security.manager=allow')
151+
}
152+
149153
// If it's a secure fixture, then depend on Kerberos Fixture and principals + add the krb5conf to the JVM options
150154
if (fixtureName.equals('secureHdfsFixture') || fixtureName.equals('secureHaHdfsFixture')) {
151155
miniHDFSArgs.add("-Djava.security.krb5.conf=${project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("hdfs")}");

server/src/main/java/org/opensearch/common/lucene/search/MultiPhrasePrefixQuery.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ public void setMaxExpansions(int maxExpansions) {
9090

9191
/**
9292
* Sets the phrase slop for this query.
93-
*
94-
* @see org.apache.lucene.search.PhraseQuery.Builder#getSlop()
9593
*/
9694
public int getSlop() {
9795
return slop;

server/src/main/java/org/opensearch/index/search/MatchQuery.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ public void setOccur(BooleanClause.Occur occur) {
227227
this.occur = occur;
228228
}
229229

230-
/**
231-
* @deprecated See {@link MatchQueryBuilder#setCommonTermsCutoff(Float)} for more details
232-
*/
233230
@Deprecated
234231
public void setCommonTermsCutoff(Float cutoff) {
235232
this.commonTermsCutoff = cutoff;

server/src/main/java/org/opensearch/indices/replication/SegmentReplicationSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface SegmentReplicationSource {
3232
/**
3333
* Get Metadata for a ReplicationCheckpoint.
3434
*
35-
* @param replicationId {@link long} - ID of the replication event.
35+
* @param replicationId long - ID of the replication event.
3636
* @param checkpoint {@link ReplicationCheckpoint} Checkpoint to fetch metadata for.
3737
* @param listener {@link ActionListener} listener that completes with a {@link CheckpointInfoResponse}.
3838
*/
@@ -41,7 +41,7 @@ public interface SegmentReplicationSource {
4141
/**
4242
* Fetch the requested segment files. Passes a listener that completes when files are stored locally.
4343
*
44-
* @param replicationId {@link long} - ID of the replication event.
44+
* @param replicationId long - ID of the replication event.
4545
* @param checkpoint {@link ReplicationCheckpoint} Checkpoint to fetch metadata for.
4646
* @param filesToFetch {@link List} List of files to fetch.
4747
* @param indexShard {@link IndexShard} Reference to the IndexShard.

test/framework/src/main/java/org/opensearch/repositories/blobstore/AbstractBlobContainerRetriesTestCase.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,6 @@ protected void sendIncompleteContent(HttpExchange exchange, byte[] bytes) throws
404404
if (bytesToSend > 0) {
405405
exchange.getResponseBody().write(bytes, rangeStart, bytesToSend);
406406
}
407-
if (randomBoolean()) {
408-
exchange.getResponseBody().flush();
409-
}
407+
exchange.getResponseBody().flush();
410408
}
411409
}

0 commit comments

Comments
 (0)