rohanag12 opened a new pull request #3311: Flip buffers using helper method
URL: https://github.com/apache/incubator-heron/pull/3311
 
 
   Java 8 and 11 have a small incompatible change in the `java.nio.Buffer` API. 
This issue crops up if Heron topologies are compiled with JDK 11, but run with 
Java 8.
   
   Until Java 8, calling the `flip()` method on any object of `Buffer` (or 
subclasses) returns a `Buffer`. For example, `ByteBuffer#flip()` returns a 
`Buffer` in Java 8.
   
   In Java 11, all subclasses of `Buffer` return objects of the subclass 
instead of `Buffer`, i.e. `ByteBuffer#flip()` returns a `ByteBuffer` in Java 11.
   
   To work around this incompatibility between Java versions, we can cast the 
buffers to `Buffer` before flipping, since we do not care about the return 
value anyways. This causes the resulting bytecode to be the same regardless of 
which Java version is used to compile it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to