capnproto / capnproto-java

Cap'n Proto in pure Java
Other
397 stars 85 forks source link

java 8 compatibility (again) #108

Closed paxel closed 3 years ago

paxel commented 3 years ago

I am so sorry, but when I checked the fix I didn't notice that my ubuntu updated to jdk 11 somehow. On the test system the error occured again

Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.mark()Ljava/nio/ByteBuffer;
    at org.capnproto.Serialize.makeByteBuffer(Serialize.java:40)
    at org.capnproto.Serialize.makeByteBufferForWords(Serialize.java:51)
    at org.capnproto.Serialize.read(Serialize.java:70)
    at org.capnproto.Serialize.read(Serialize.java:66)

And I was so astonished that your fixed worked that easy, while we had to introduce maven profiles to compile correctly on different JDKs.

I will check what's going on here. I assume that using both source+target and release don't work

      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
      <maven.compiler.release>8</maven.compiler.release>
paxel commented 3 years ago

the maven compiler plugin is too old and doesn't know the parameter

| String | 3.6 | The -release argument for the Java compiler, supported since Java9User property is: maven.compiler.release. -- | -- | -- | -- when you switch to the version 3.6.2 the release parameter is actually given to the javac call and works for JDK 11 for JDK 8: ``` [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile (default-compile) on project runtime: Fatal error compiling: invalid flag: --release -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile (default-compile) on project runtime: Fatal error compiling ``` so the release property can not be used under JDK. it's a mess
paxel commented 3 years ago

runtime/pom.xml that works on jdk8 and 11

https://github.com/capnproto/capnproto-java/pull/109

dwrensha commented 3 years ago

Closed by #109

paxel commented 3 years ago

@dwrensha any chance for releasing this change soon?

dwrensha commented 3 years ago

done