Skip to content
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

core: fix java.nio.ByteBuffer Java 9+ incompatible usage #6839

Merged
merged 1 commit into from Mar 18, 2020

Conversation

dapengzhang0
Copy link
Member

No description provided.

@dapengzhang0 dapengzhang0 changed the title core: fix NioBuffer Java 9+ incompatible usage core: fix java.nio.ByteBuffer Java 9+ incompatible usage Mar 18, 2020
@voidzcy
Copy link
Contributor

voidzcy commented Mar 18, 2020

We shouldn't need this, as we have sourceCompatibility = 1.7 in main build.gradle.

See my latest comment in #6829 (comment).

@dapengzhang0
Copy link
Member Author

This is for third party users who build grpc source with Java 9+, and publish to maven local, even with sourceCompatibility = 1.7 and targetCompatibility = 1.7 unchanged. Their android app or java 8 app with grpc library in local maven repo would fail.

@voidzcy
Copy link
Contributor

voidzcy commented Mar 18, 2020

This is for third party users who build grpc source with Java 9+, and publish to maven local, even with sourceCompatibility = 1.7 and targetCompatibility = 1.7 unchanged. Their android app or java 8 app with grpc library in local maven repo would fail.

Would they fail? I don't think so as long as gRPC has sourceCompatibility = 1.7. I remember I tried this before and it worked without any issue.

@dapengzhang0
Copy link
Member Author

Would they fail? I don't think so as long as gRPC has sourceCompatibility = 1.7. I remember I tried this before and it worked without any issue.

If you publish maven local of grpc master with java 11, and then build examples/android, you will fail. If you suppress the failure by dontwarn, you might fail in the runtime.

@voidzcy
Copy link
Contributor

voidzcy commented Mar 18, 2020

After looking around for a while, this seems to be more than source/target compatibility issue. The generated bytecode with JDK 9+ for method ByteBuffer#limit(int) would be treated as an overloaded method instead of an overridden method. So it cannot be found in JDK8's ByteBuffer.

@dapengzhang0
Copy link
Member Author

After looking around for a while, this seems to be more than source/target compatibility issue. The generated bytecode with JDK 9+ for method ByteBuffer#limit(int) would be treated as an overloaded method instead of an overridden method. So it cannot be found in JDK8's ByteBuffer.

Yes, the same source can be compiled and run in all jdk's, but in different binaries, and the jdk9+ binary is not backward compatible.

@dapengzhang0 dapengzhang0 merged commit e739eea into grpc:master Mar 18, 2020
@dapengzhang0 dapengzhang0 deleted the fix-nio-buffer branch March 18, 2020 23:07
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants