davidzollo opened a new pull request, #10994:
URL: https://github.com/apache/seatunnel/pull/10994

   ## Purpose
   
   Fix a JDK 8 runtime incompatibility in `StainTracePayload#append`.
   
   ## Problem
   
   In JDK 9+, `ByteBuffer` added a covariant override of `Buffer.position(int)` 
that returns `ByteBuffer` instead of `Buffer`.  
   When the project is **compiled on JDK 9+** (which emits bytecode referencing 
`ByteBuffer.position(I)LByteBuffer;`) and then **run on JDK 8**, the JVM cannot 
resolve that method descriptor and throws:
   
   ```
   java.lang.NoSuchMethodError: 
java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
   ```
   
   The affected line is in `append()`:
   
   ```java
   // before – compiled reference to ByteBuffer.position(I)LByteBuffer; → 
NoSuchMethodError on JDK 8
   buffer.position(payload.length);
   ```
   
   ## Fix
   
   Cast to the `Buffer` superclass so the call always resolves to 
`Buffer.position(I)LBuffer;`, which exists on every JDK version:
   
   ```java
   ((Buffer) buffer).position(payload.length);
   ```
   
   This is the standard idiom used throughout the JDK and many libraries to 
keep `ByteBuffer` code compatible with JDK 8.
   
   ## Checklist
   
   - [x] Code compiles and existing unit tests (`StainTracePayloadTest`) pass
   - [x] No behaviour change – only the method-resolution path in bytecode is 
affected


-- 
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