forked from netty/netty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug where Netty fails to load a shaded native library (netty#12358
) Related: netty/netty-jni-util#13 Motivation: Netty can't load a shaded native library because `netty-jni-util` has a bug that appends an extra `/` when attmpting JNI `FindClass`. For example, `parsePackagePrefix()` returns `shaded//` instead of `shaded/`, leading to a bad attempt to load `shaded//io/netty/...`. Netty also doesn't handle the case where a shaded package name contains an underscore (`_`), such as `my_shaded_deps.io.netty.*`, because it simply replaces `.` with `_` and vice versa. JNI specification defines a mangling rule to avoid this issue: - https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/design.html#resolving_native_method_names Modifications: - Replace `_` into `_1` so that `parsePackagePrefix()` in `netty-jni-utils.c` can get the correct package name later. - Update the `docker-compose.yaml` so that the integration tests in `testsuite-shading` are always run as a part of CI, so we don't have a regression in the future. Result: - A user can use a functionality that requires a native library even if they shaded Netty *and* the shaded package name contains an underscore (`_`).
- Loading branch information
Showing
4 changed files
with
35 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters