Skip to content

Commit 2424345

Browse files
committed
Move to JDK 25 for build only
Signed-off-by: Bala.FA <bala@minio.io>
1 parent 942e2e5 commit 2424345

16 files changed

Lines changed: 165 additions & 94 deletions

File tree

.gitattributes

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
* text eol=lf
1+
# Normalize text files to LF, but let Git auto-detect binaries so they are
2+
# stored byte-for-byte (a blanket "* text" corrupts binaries like the Gradle
3+
# wrapper jar by stripping CR bytes during line-ending normalization).
4+
* text=auto eol=lf
5+
6+
# Always treat these as binary regardless of auto-detection.
7+
*.jar binary
8+
*.zip binary
9+
*.gz binary
10+
*.class binary
11+
*.png binary
12+
*.jpg binary
13+
*.gif binary
14+
*.ico binary

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ jobs:
3939

4040
steps:
4141
- name: Checkout repository
42-
uses: actions/checkout@v6
42+
uses: actions/checkout@v7
4343

44-
- name: Set up Java 17
44+
- name: Setup java 25
4545
uses: actions/setup-java@v5
4646
with:
47-
java-version: '17'
48-
distribution: 'temurin'
47+
distribution: temurin
48+
java-version: '25'
4949

5050
# Initializes the CodeQL tools for scanning.
5151
- name: Initialize CodeQL

.github/workflows/gradle.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
os: [ubuntu-latest, windows-latest]
2020

2121
steps:
22-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@v7
2323

2424
- name: Check limited Guava usage
2525
if: matrix.os == 'ubuntu-latest'
@@ -29,11 +29,11 @@ jobs:
2929
exit 1
3030
fi
3131
32-
- name: Setup java 17 for building
32+
- name: Setup java 25 for building
3333
uses: actions/setup-java@v5
3434
with:
3535
distribution: temurin
36-
java-version: '17'
36+
java-version: '25'
3737

3838
- name: Set environment variables on Ubuntu
3939
if: matrix.os == 'ubuntu-latest'
@@ -59,7 +59,7 @@ jobs:
5959
./gradlew.bat build
6060
6161
- name: Setup java ${{ matrix.java-version }} for testing
62-
if: matrix.java-version != '17'
62+
if: matrix.java-version != '25'
6363
uses: actions/setup-java@v5
6464
with:
6565
distribution: temurin
@@ -69,20 +69,20 @@ jobs:
6969
if: matrix.os == 'ubuntu-latest'
7070
run: |
7171
cd functional
72-
curl -sSfLO https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.11.4/junit-platform-console-standalone-1.11.4.jar
73-
curl -sSfLO https://repo1.maven.org/maven2/com/github/spotbugs/spotbugs-annotations/4.9.8/spotbugs-annotations-4.9.8.jar
74-
javac -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:../adminapi/build/libs/minio-admin-${DEV_VERSION}-all.jar:. FunctionalTest.java
75-
java -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:../adminapi/build/libs/minio-admin-${DEV_VERSION}-all.jar:. FunctionalTest
76-
javac -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:. ./TestUserAgent.java
77-
java -Dversion=${DEV_VERSION} -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:. TestUserAgent
78-
javac -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${RELEASE_VERSION}-all.jar:. ./TestUserAgent.java
79-
java -Dversion=${RELEASE_VERSION} -cp spotbugs-annotations-4.9.8.jar:junit-platform-console-standalone-1.11.4.jar:../api/build/libs/minio-${RELEASE_VERSION}-all.jar:. TestUserAgent
72+
curl -sSfLO https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.14.4/junit-platform-console-standalone-1.14.4.jar
73+
curl -sSfLO https://repo1.maven.org/maven2/com/github/spotbugs/spotbugs-annotations/4.10.3/spotbugs-annotations-4.10.3.jar
74+
javac -cp spotbugs-annotations-4.10.3.jar:junit-platform-console-standalone-1.14.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:../adminapi/build/libs/minio-admin-${DEV_VERSION}-all.jar:. FunctionalTest.java
75+
java -cp spotbugs-annotations-4.10.3.jar:junit-platform-console-standalone-1.14.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:../adminapi/build/libs/minio-admin-${DEV_VERSION}-all.jar:. FunctionalTest
76+
javac -cp spotbugs-annotations-4.10.3.jar:junit-platform-console-standalone-1.14.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:. ./TestUserAgent.java
77+
java -Dversion=${DEV_VERSION} -cp spotbugs-annotations-4.10.3.jar:junit-platform-console-standalone-1.14.4.jar:../api/build/libs/minio-${DEV_VERSION}-all.jar:. TestUserAgent
78+
javac -cp spotbugs-annotations-4.10.3.jar:junit-platform-console-standalone-1.14.4.jar:../api/build/libs/minio-${RELEASE_VERSION}-all.jar:. ./TestUserAgent.java
79+
java -Dversion=${RELEASE_VERSION} -cp spotbugs-annotations-4.10.3.jar:junit-platform-console-standalone-1.14.4.jar:../api/build/libs/minio-${RELEASE_VERSION}-all.jar:. TestUserAgent
8080
8181
- name: Run tests on Windows
8282
if: matrix.os == 'windows-latest'
8383
run: |
8484
cd functional
85-
curl -sSfLO https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.11.4/junit-platform-console-standalone-1.11.4.jar
86-
curl -sSfLO https://repo1.maven.org/maven2/com/github/spotbugs/spotbugs-annotations/4.9.8/spotbugs-annotations-4.9.8.jar
87-
javac -encoding UTF-8 -cp "spotbugs-annotations-4.9.8.jar;junit-platform-console-standalone-1.11.4.jar;../api/build/libs/minio-$Env:DEV_VERSION-all.jar;../adminapi/build/libs/minio-admin-$Env:DEV_VERSION-all.jar;." FunctionalTest.java
88-
java -cp "spotbugs-annotations-4.9.8.jar;junit-platform-console-standalone-1.11.4.jar;../api/build/libs/minio-$Env:DEV_VERSION-all.jar;../adminapi/build/libs/minio-admin-$Env:DEV_VERSION-all.jar;." FunctionalTest
85+
curl -sSfLO https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.14.4/junit-platform-console-standalone-1.14.4.jar
86+
curl -sSfLO https://repo1.maven.org/maven2/com/github/spotbugs/spotbugs-annotations/4.10.3/spotbugs-annotations-4.10.3.jar
87+
javac -encoding UTF-8 -cp "spotbugs-annotations-4.10.3.jar;junit-platform-console-standalone-1.14.4.jar;../api/build/libs/minio-$Env:DEV_VERSION-all.jar;../adminapi/build/libs/minio-admin-$Env:DEV_VERSION-all.jar;." FunctionalTest.java
88+
java -cp "spotbugs-annotations-4.10.3.jar;junit-platform-console-standalone-1.14.4.jar;../api/build/libs/minio-$Env:DEV_VERSION-all.jar;../adminapi/build/libs/minio-admin-$Env:DEV_VERSION-all.jar;." FunctionalTest

adminapi/src/main/java/io/minio/admin/MinioAdminClient.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,10 @@ public long getBucketQuota(String bucketName) throws MinioException {
453453
OBJECT_MAPPER
454454
.getTypeFactory()
455455
.constructMapType(HashMap.class, String.class, JsonNode.class);
456-
return OBJECT_MAPPER.<Map<String, JsonNode>>readValue(response.body().bytes(), mapType)
457-
.entrySet().stream()
456+
return OBJECT_MAPPER
457+
.<Map<String, JsonNode>>readValue(response.body().bytes(), mapType)
458+
.entrySet()
459+
.stream()
458460
.filter(entry -> "quota".equals(entry.getKey()))
459461
.findFirst()
460462
.map(entry -> Long.valueOf(entry.getValue().toString()))

api/src/main/java/io/minio/Checksum.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
public class Checksum {
3434
/** MD5 hash of zero length byte array. */
3535
public static final String ZERO_MD5_HASH = "1B2M2Y8AsgTpgAmY7PhCfg==";
36+
3637
/** SHA-256 hash of zero length byte array. */
3738
public static final String ZERO_SHA256_HASH =
3839
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";

api/src/main/java/io/minio/Http.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ public static OkHttpClient setTimeout(
890890
.build();
891891
}
892892

893-
/** HTTP body of {@link RandomAccessFile}, {@link ByteBuffer} or {@link byte} array. */
893+
/** HTTP body of {@link RandomAccessFile}, {@link ByteBuffer} or {@code byte} array. */
894894
public static class Body {
895895
private okhttp3.RequestBody requestBody;
896896
private RandomAccessFile file;

api/src/main/java/io/minio/PartReader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ private void readOneByte() throws MinioException {
9696
int n = 0;
9797

9898
try {
99-
while ((n = file != null ? file.read(oneByte) : stream.read(oneByte)) == 0) ;
99+
while ((n = file != null ? file.read(oneByte) : stream.read(oneByte)) == 0)
100+
;
100101
} catch (IOException e) {
101102
throw new MinioException(e);
102103
}

api/src/main/java/io/minio/errors/MinioException.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,26 @@ public String httpTrace() {
6262

6363
/** Throws encapsulated exception. */
6464
public void throwEncapsulatedException()
65-
throws BucketPolicyTooLargeException, CertificateException, EOFException,
66-
ErrorResponseException, FileNotFoundException, GeneralSecurityException,
67-
InsufficientDataException, InternalException, InvalidKeyException,
68-
InvalidResponseException, IOException, JsonMappingException, JsonParseException,
69-
JsonProcessingException, KeyManagementException, KeyStoreException, MinioException,
70-
NoSuchAlgorithmException, ServerException, XmlParserException {
65+
throws BucketPolicyTooLargeException,
66+
CertificateException,
67+
EOFException,
68+
ErrorResponseException,
69+
FileNotFoundException,
70+
GeneralSecurityException,
71+
InsufficientDataException,
72+
InternalException,
73+
InvalidKeyException,
74+
InvalidResponseException,
75+
IOException,
76+
JsonMappingException,
77+
JsonParseException,
78+
JsonProcessingException,
79+
KeyManagementException,
80+
KeyStoreException,
81+
MinioException,
82+
NoSuchAlgorithmException,
83+
ServerException,
84+
XmlParserException {
7185
Throwable e = getCause();
7286

7387
// Inherited by MinioException

build.gradle

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
*/
1616

1717
/********************************/
18-
/* gradleVersion = '9.4.1' */
18+
/* gradleVersion = '9.7.0' */
1919
/********************************/
2020

2121
plugins {
22-
id 'com.gradleup.shadow' version '9.0.0'
23-
id 'com.github.spotbugs' version '6.5.1'
24-
id 'org.jreleaser' version '1.23.0'
25-
id 'com.diffplug.spotless' version '6.13.0'
22+
id 'com.gradleup.shadow' version '9.6.1'
23+
id 'com.github.spotbugs' version '6.5.10'
24+
id 'org.jreleaser' version '1.25.0'
25+
id 'com.diffplug.spotless' version '8.9.0'
2626
}
2727

2828
/* Root project definitions */
@@ -48,22 +48,26 @@ subprojects {
4848
dependencies {
4949
api 'com.carrotsearch.thirdparty:simple-xml-safe:2.7.1'
5050
api 'com.google.guava:guava:33.6.0-jre'
51-
api 'com.squareup.okhttp3:okhttp:5.3.2'
52-
api 'com.fasterxml.jackson.core:jackson-annotations:2.21'
53-
api 'com.fasterxml.jackson.core:jackson-core:2.21.2'
54-
api 'com.fasterxml.jackson.core:jackson-databind:2.21.2'
55-
api 'org.bouncycastle:bcprov-jdk18on:1.84'
51+
api 'com.squareup.okhttp3:okhttp:5.4.0'
52+
api 'com.fasterxml.jackson.core:jackson-annotations:2.22'
53+
api 'com.fasterxml.jackson.core:jackson-core:2.22.1'
54+
api 'com.fasterxml.jackson.core:jackson-databind:2.22.1'
55+
api 'org.bouncycastle:bcprov-jdk18on:1.85.2'
5656
api 'org.apache.commons:commons-compress:1.28.0'
57-
api 'commons-codec:commons-codec:1.21.0'
57+
api 'commons-codec:commons-codec:1.22.1'
5858
api 'org.xerial.snappy:snappy-java:1.1.10.8'
59-
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.8'
59+
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.10.3'
6060

61-
testImplementation 'com.squareup.okhttp3:mockwebserver:5.3.2'
62-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.14.3'
61+
testImplementation 'com.squareup.okhttp3:mockwebserver:5.4.0'
62+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.14.4'
6363
}
6464

6565
[compileJava, compileTestJava].each() {
6666
it.options.fork = true
67+
// Build runs on JDK 25 (see java.toolchain) but enforces the Java 8 API surface and
68+
// emits Java 8 bytecode via --release 8. --release also avoids the "source/target 8 is
69+
// obsolete" warning; -Xlint:-options is kept as a belt-and-braces guard for -Werror.
70+
it.options.release = 8
6771
it.options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation', '-Xlint:-options', '-Werror', '-Xdiags:verbose']
6872
it.options.encoding = 'UTF-8'
6973
}
@@ -103,6 +107,10 @@ subprojects {
103107
check.dependsOn localeTest
104108

105109
java {
110+
// Compile/test/javadoc run on JDK 25; bytecode/API level pinned to Java 8 via release below.
111+
toolchain {
112+
languageVersion = JavaLanguageVersion.of(25)
113+
}
106114
sourceCompatibility = JavaVersion.VERSION_1_8
107115
targetCompatibility = JavaVersion.VERSION_1_8
108116
}
@@ -112,7 +120,7 @@ subprojects {
112120
target '**/*.java'
113121
importOrder 'edu', 'com', 'io', 'java', 'javax', 'org', ''
114122
removeUnusedImports()
115-
googleJavaFormat('1.7')
123+
googleJavaFormat('1.35.0')
116124
}
117125
groovyGradle {
118126
target '*.gradle'
@@ -168,6 +176,16 @@ project(':api') {
168176
dependsOn tasks.named('shadowJar')
169177
}
170178

179+
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
180+
// okhttp/okio/kotlin-stdlib each ship a distinct META-INF/*.kotlin_module marker file.
181+
// Shadow's KotlinModuleMetadataTransformer expects to see every duplicate, but the
182+
// default EXCLUDE strategy would drop them beforehand; WARN lets the transformer run
183+
// and still logs if a real duplicate ever shows up (gradleup.com/shadow/configuration/merging).
184+
filesMatching('META-INF/*.kotlin_module') {
185+
duplicatesStrategy = DuplicatesStrategy.WARN
186+
}
187+
}
188+
171189
tasks.withType(Jar).configureEach {
172190
doLast {
173191
def jarFile = archiveFile.get().asFile
@@ -226,7 +244,7 @@ project(':api') {
226244
}
227245

228246
signing {
229-
required {
247+
required = {
230248
gradle.taskGraph.allTasks.any { it.name.contains('LocalMavenWithChecksums') }
231249
}
232250
sign publishing.publications.minioJava
@@ -246,7 +264,7 @@ project(':adminapi') {
246264

247265
dependencies {
248266
api project(':api')
249-
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.2'
267+
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.22.1'
250268
testImplementation project(':api')
251269
}
252270

@@ -288,6 +306,16 @@ project(':adminapi') {
288306
dependsOn tasks.named('shadowJar')
289307
}
290308

309+
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
310+
// okhttp/okio/kotlin-stdlib each ship a distinct META-INF/*.kotlin_module marker file.
311+
// Shadow's KotlinModuleMetadataTransformer expects to see every duplicate, but the
312+
// default EXCLUDE strategy would drop them beforehand; WARN lets the transformer run
313+
// and still logs if a real duplicate ever shows up (gradleup.com/shadow/configuration/merging).
314+
filesMatching('META-INF/*.kotlin_module') {
315+
duplicatesStrategy = DuplicatesStrategy.WARN
316+
}
317+
}
318+
291319
tasks.withType(Jar).configureEach {
292320
doLast {
293321
def jarFile = archiveFile.get().asFile
@@ -346,7 +374,7 @@ project(':adminapi') {
346374
}
347375

348376
signing {
349-
required {
377+
required = {
350378
gradle.taskGraph.allTasks.any { it.name.contains('LocalMavenWithChecksums') }
351379
}
352380
sign publishing.publications.minioJava
@@ -355,7 +383,7 @@ project(':adminapi') {
355383

356384
project(':examples') {
357385
dependencies {
358-
compileOnly 'me.tongfei:progressbar:0.9.5'
386+
compileOnly 'me.tongfei:progressbar:0.10.2'
359387
compileOnly project(':api')
360388
}
361389

@@ -367,14 +395,17 @@ project(':examples') {
367395
main {
368396
java {
369397
srcDirs = ["$rootDir/examples"]
398+
// srcDir is the module root, which also contains build/; keep generated
399+
// files (e.g. Spotless lint output) out of compilation.
400+
exclude 'build/**'
370401
}
371402
}
372403
}
373404
}
374405

375406
project(':functional') {
376407
dependencies {
377-
implementation 'org.junit.jupiter:junit-jupiter-api:5.14.3'
408+
implementation 'org.junit.jupiter:junit-jupiter-api:5.14.4'
378409
implementation project(':api')
379410
implementation project(':adminapi')
380411
}
@@ -387,6 +418,9 @@ project(':functional') {
387418
main {
388419
java {
389420
srcDirs = ["$rootDir/functional"]
421+
// srcDir is the module root, which also contains build/; keep generated
422+
// files (e.g. Spotless lint output) out of compilation.
423+
exclude 'build/**'
390424
}
391425
}
392426
}

functional/TestMinioClient.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,9 @@ public void putObject() throws Exception {
548548

549549
testPutObject(
550550
"[object name ends with '/']",
551-
PutObjectArgs.builder().bucket(bucketName).object("path/to/" + getRandomName() + "/")
551+
PutObjectArgs.builder()
552+
.bucket(bucketName)
553+
.object("path/to/" + getRandomName() + "/")
552554
.stream(new ContentInputStream(0), 0L, null)
553555
.contentType(CUSTOM_CONTENT_TYPE)
554556
.build(),
@@ -1445,7 +1447,9 @@ public void testCopyObject(
14451447
client.makeBucket(MakeBucketArgs.builder().bucket(args.source().bucket()).build());
14461448
try {
14471449
PutObjectArgs.Builder builder =
1448-
PutObjectArgs.builder().bucket(args.source().bucket()).object(args.source().object())
1450+
PutObjectArgs.builder()
1451+
.bucket(args.source().bucket())
1452+
.object(args.source().object())
14491453
.stream(new ContentInputStream(1 * KB), 1L * KB, null);
14501454
if (sse != null) builder.sse(sse);
14511455
client.putObject(builder.build());

0 commit comments

Comments
 (0)