Skip to content

bug: Java binding compile error when using JDK 23 #5292

Closed
@morristai

Description

@morristai

Describe the bug

It works when using JDK 21, 17, 11. But failed with JDK 23. Although OpenDAL's Java Binding is tested against Java 8.

opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java on  main [$?] is 📦 [email protected] via 🦀 1.82.0 via ☕ v23.0.1
→ ./mvnw clean install -DskipTests=true -Dcargo-build.profile=release
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: osx
[INFO] os.detected.arch: aarch_64
[INFO] os.detected.bitness: 64
[INFO] os.detected.version: 14.7
[INFO] os.detected.version.major: 14
[INFO] os.detected.version.minor: 7
[INFO] os.detected.classifier: osx-aarch_64
[INFO]
[INFO] ---------------------< org.apache.opendal:opendal >---------------------
[INFO] Building Apache OpenDAL™ 0.47.4
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ opendal ---
[INFO] Deleting /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java/target
[INFO]
[INFO] --- enforcer:3.1.0:enforce (enforce-maven-version) @ opendal ---
[INFO]
[INFO] --- enforcer:3.1.0:enforce (enforce-java-version) @ opendal ---
[INFO]
[INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ opendal ---
[INFO] Preparing remote bundle org.apache:apache-jar-resource-bundle:1.4
[INFO] Copying 3 resources from 1 bundle.
[INFO]
[INFO] --- resources:3.3.0:resources (default-resources) @ opendal ---
[INFO] Copying 1 resource
[INFO] Copying 3 resources
[INFO] The encoding used to copy filtered properties files have not been set. This means that the same encoding will be used to copy filtered properties files as when copying other filtered resources. This might not be what you want! Run your build with --debug to see which files might be affected. Read more at https://maven.apache.org/plugins/maven-resources-plugin/examples/filtering-properties-files.html
[INFO]
[INFO] --- compiler:3.10.1:compile (default-compile) @ opendal ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 20 source files to /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java/src/main/java/org/apache/opendal/PresignedRequest.java:[30,26] variable method not initialized in the default constructor
[ERROR] /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java/src/main/java/org/apache/opendal/PresignedRequest.java:[35,26] variable uri not initialized in the default constructor
[ERROR] /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java/src/main/java/org/apache/opendal/PresignedRequest.java:[40,39] variable headers not initialized in the default constructor
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.202 s
[INFO] Finished at: 2024-11-06T11:39:15-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project opendal: Compilation failure: Compilation failure:
[ERROR] /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java/src/main/java/org/apache/opendal/PresignedRequest.java:[30,26] variable method not initialized in the default constructor
[ERROR] /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java/src/main/java/org/apache/opendal/PresignedRequest.java:[35,26] variable uri not initialized in the default constructor
[ERROR] /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java/src/main/java/org/apache/opendal/PresignedRequest.java:[40,39] variable headers not initialized in the default constructor
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]

Steps to Reproduce

svn co https://dist.apache.org/repos/dist/dev/opendal/0.50.2-rc.1/ opendal-dev
cd opendal-dev/apache-opendal-bindings-java-0.47.5-src/bindings/java

./mvnw clean install -DskipTests=true -Dcargo-build.profile=release

Expected Behavior

> LICENSE file exists in /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src
> Start checking NOTICE file in /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src
> NOTICE file exists in /Users/morristai/Documents/Whynot/opendal/opendal-dev/apache-opendal-bindings-java-0.47.5-src
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Zulu21.30+15-CA (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Zulu21.30+15-CA (build 21.0.1+12-LTS, mixed mode, sharing)
Start building opendal java binding
> Success to build opendal java binding

Additional Context

cc @tisonkun #5281 (comment)

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions