-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can Linkage Checker detect the bad Java8-incompatible byte code #1605
Comments
For protocolbuffers/protobuf#7827, could Linkage Monitor detect this as part of the PR check, if Linkage Checker is capable to detect the invalid references? It seems no. If the check builds protobuf-java JAR file with Java 11, then Linkage Monitor could detect it. If it was with Java 8, then the resulting JAR file is fine. |
This is a really interesting one. Some take-aways:
|
Nice. It sounds like this will check for compatibility against the JDK that you're using to build? So, if you want to check for compatibility with JDK 8, then you'll need to build with JDK 8? That makes it helpful for detecting problems in your dependencies but not necessarily helpful for detecting problems in your own code (since you'd already detect/avoid these by building with JDK 8 in the first place). That's fine; I had just been initially hoping for an improvement on Animal Sniffer, too. |
Yes, it detect the compatibility with the JDK Linkage Checker is running on. If we enhance the check script to build protobuf-java in Java 11 and running Linkage Checker with Java 8, #1607 should detect the invalid method references. Memo: script for current check https://github.com/protocolbuffers/protobuf/blob/master/tests.sh#L252 uses Java 8 for both. |
Thanks. If you're interested, it is probably possible to detect problems even when building with Java 11: Java 9+ comes bundled with API signatures of not only the current version of Java but also of older versions. See That still requires that users tell the Linkage Checker which version of Java to check against. I don't suppose it possible to guess a sensible default based on the |
@cpovirk Thank you for information. |
Can Linkage Checker (Linkage Monitor) detect the wrong byte code that does not work with Java 8 (case protocolbuffers/protobuf#7827)
Wrong byte code for Java8 that has reference to
CharBuffer CharBuffer.flip()
(java.nio.CharBuffer.flip()Ljava/nio/CharBuffer
). In JRE 8, it'sBuffer Buffer.flip()
(the return type is different).As of now, references to all system classes (including
java.nio.CharBuffer
) are skipped.The text was updated successfully, but these errors were encountered: