Closed
Conversation
Changed variable declarations to use 'inline constexpr' for better optimization.
Owner
|
Two potential issues:
|
Author
|
I also noticed some syntax issues when trying to build on Windows with
the previous changes. To fix both problems, I have reverted the constants
to const char* while keeping them inline constexpr. This maintains the
modernization of the code while ensuring full compatibility with JNI and
fixing the build errors on Windows
…On Tue, Apr 14, 2026 at 3:07 AM JingMatrix ***@***.***> wrote:
*JingMatrix* left a comment (JingMatrix/Vector#663)
<#663 (comment)>
Two potential issues:
1. Your new handling of string passing seems fragile to me, please
explain why would you change it.
2. https://en.cppreference.com/w/cpp/string/basic_string_view/data.html
states that string_view data may not be null-terminated, and JNI is
sensitive about it:
https://docs.oracle.com/en/java/javase/11/docs/specs/jni/types.html#modified-utf-8-strings
. Indeed, NewStringUTF takes a C-style pointer and expects MUTF-8, the
underlying JVM implementation relies entirely on C's null-termination rule
to find the end of the string.
—
Reply to this email directly, view it on GitHub
<#663 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFZBWL7AGIJYNFLNK3BFMJL4VVJILAVCNFSM6AAAAACXX5EV2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DEMZZGYZTKMJXG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Author
|
ok i goin to fix it
…On Tue, Apr 14, 2026 at 3:11 AM Aantik Mods ***@***.***> wrote:
I also noticed some syntax issues when trying to build on Windows with
the previous changes. To fix both problems, I have reverted the constants
to const char* while keeping them inline constexpr. This maintains the
modernization of the code while ensuring full compatibility with JNI and
fixing the build errors on Windows
On Tue, Apr 14, 2026 at 3:07 AM JingMatrix ***@***.***>
wrote:
> *JingMatrix* left a comment (JingMatrix/Vector#663)
> <#663 (comment)>
>
> Two potential issues:
>
> 1. Your new handling of string passing seems fragile to me, please
> explain why would you change it.
> 2.
> https://en.cppreference.com/w/cpp/string/basic_string_view/data.html
> states that string_view data may not be null-terminated, and JNI is
> sensitive about it:
> https://docs.oracle.com/en/java/javase/11/docs/specs/jni/types.html#modified-utf-8-strings
> . Indeed, NewStringUTF takes a C-style pointer and expects MUTF-8,
> the underlying JVM implementation relies entirely on C's null-termination
> rule to find the end of the string.
>
> —
> Reply to this email directly, view it on GitHub
> <#663 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BFZBWL7AGIJYNFLNK3BFMJL4VVJILAVCNFSM6AAAAACXX5EV2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DEMZZGYZTKMJXG4>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Owner
|
Okay, please also paste the Windows environment build error and warning for me to understand better the context. If so, the main purpose of this PR should be to ensure Window compilation compatibility. |
ispointer
commented
Apr 13, 2026
Author
ispointer
left a comment
There was a problem hiding this comment.
I have updated the constants from std::string_view back to const char* while maintaining the inline constexpr usage. This ensures that the strings are null-terminated, making them safe for JNI's NewStringUTF and resolving the potential memory issues. I also confirmed that these changes resolve the syntax issues during Windows builds. Please have a look
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This pull request focuses on modernizing the native C++ code and improving the way string constants are handled across the project. I have updated the Gradle build scripts to use more reliable string escaping and introduced the V_TOSTR macro to safely manage preprocessor definitions like version names and package IDs. Additionally, I refactored several constants from old-style pointers to modern C++ features like inline constexpr and std::string_view, which makes the code faster and more memory-efficient. Along with these changes, I cleaned up the module logic by removing redundant keywords, adding necessary headers, and simplifying JNI comparisons to ensure better stability and maintainability for the entire module