code-disaster / steamworks4j

A thin Java wrapper to access the Steamworks API
https://code-disaster.github.io/steamworks4j/
MIT License
468 stars 64 forks source link

Set Java bytecode compatibility version explicitly #122

Closed LobbyDivinus closed 1 year ago

LobbyDivinus commented 1 year ago

Fix building repo with modern Java causes incompatible bytecode. See https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/ on why that is and why the source and target flags are insufficient. Had to also bump the maven-compile-plugin version to support the release flag.

In my case the call to ByteBuffer.limit caused a MethodNotFound exception when

  1. Compiled with Java 17
  2. Executed on Java 1.8
code-disaster commented 1 year ago

Your change doesn't work when building with JDK 8, since it doesn't know about --release yet. I modified it using a Maven profile, and added the same change to the other modules.