Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(java_indexer): add names for native methods#6108

Merged
zrlk merged 2 commits intokythe:masterfrom
zrlk:java-native-methods
Apr 22, 2024
Merged

feat(java_indexer): add names for native methods#6108
zrlk merged 2 commits intokythe:masterfrom
zrlk:java-native-methods

Conversation

@zrlk
Copy link
Contributor

@zrlk zrlk commented Apr 19, 2024

This PR emits name nodes in the csymbol language for Java native methods according to the JNI spec at
https://docs.oracle.com/en/java/javase/11/docs/specs/jni/design.html .

Doing this for the JVM indexer is left to future work, mainly thanks to an annoying detail that makes it necessary to know whether a method has multiple native overloads to determine if it will be given a symbol without arguments.

This PR emits name nodes in the csymbol language for Java
native methods according to the JNI spec at
https://docs.oracle.com/en/java/javase/11/docs/specs/jni/design.html .

Doing this for the JVM indexer is left to future work, mainly
thanks to an annoying detail that makes it necessary to know whether
a method has multiple native overloads to determine if it will be
given a symbol without arguments.
@zrlk zrlk requested a review from a team April 19, 2024 23:31
return parentClass.qualifiedName + "." + methodName + methodType;
}

private static String jniMangle(String s) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this or an equivalent not provided by the JDK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is implemented in com/sun/tools/javac/jvm/JNIWriter.java, which doesn't expose any sort of external API (the methods are package visible).

@zrlk zrlk merged commit de55eb3 into kythe:master Apr 22, 2024
@zrlk zrlk deleted the java-native-methods branch April 22, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments