You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "davidzollo (via GitHub)" <gi...@apache.org> on 2026/06/02 04:07:23 UTC

[PR] [Fix][Engine] Fix JDK 8 NoSuchMethodError in StainTracePayload#append [seatunnel]

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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Engine] Fix JDK 8 NoSuchMethodError in StainTracePayload#append [seatunnel]

Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on PR #10994:
URL: https://github.com/apache/seatunnel/pull/10994#issuecomment-4598877735

   +1 good job🚀


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Engine] Fix JDK 8 NoSuchMethodError in StainTracePayload#append [seatunnel]

Posted by "dybyte (via GitHub)" <gi...@apache.org>.
dybyte merged PR #10994:
URL: https://github.com/apache/seatunnel/pull/10994


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org