jihuayu opened a new issue, #8650:
URL: https://github.com/apache/opendal/issues/8650

   ### Feature Description
   
   Following the code generation architecture in the .NET binding 
(`dev/src/generate/dotnet.rs`, #8440) and building upon `ServiceConfig.java` in 
`dev/src/generate/java.rs`, we propose migrating the Java binding's data models 
(`Capability`, `Metadata`) and operation options (`*Options`) to be generated 
directly from OpenDAL core via `just generate java`.
   
   ### Problem and Solution
   
   Currently, `Capability.java`, `Metadata.java`, `*Options.java`, and their 
JNI conversion functions in `bindings/java/src/lib.rs` are maintained by hand:
   - Positional constructors and long JNI descriptor strings (`(ZZZZ...Z)V`) 
cause frequent merge conflicts across concurrent PRs and risk silent field 
transposition.
   - Core additions to `Capability`, `Metadata`, and 
`opendal::options::*Options` (such as `ListOptions.glob`, new `Metadata` 
attributes, and conditional/TTL `WriteOptions` fields) drift from the Java 
binding and require repetitive manual plumbing.
   
   Since `dev/src/generate/` already provides language-agnostic AST parsers for 
core definitions (`capability.rs`, `metadata.rs`, and `core_options.rs`), we 
plan to migrate `bindings/java` to the same single-source-of-truth codegen 
model in stages:
   
   #### Tasks (`dev/src/generate/java.rs`)
   - [ ] Generate `Capability.java` and `bindings/java/src/capability.rs` from 
`core/core/src/types/capability.rs` (#8644)
   - [ ] Generate `Metadata.java` and `bindings/java/src/metadata.rs` from 
`core/core/src/types/metadata.rs`
   - [ ] Generate `*Options.java` and `bindings/java/src/options.rs` from 
`core/core/src/types/options.rs`
   
   ### Additional Context
   
   - Related closed tracking issues: #6214, #6226
   - Reference .NET generator implementation: #8440
   
   ### Are you willing to contribute to the development of this feature?
   
   - [x] Yes, I am willing to contribute to the development of this feature.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to