On Thu, 27 Jun 2024 13:15:19 GMT, Julian Waters <[email protected]> wrote:

> It would be helpful if JNI had a jobject unique_ptr type for C++

But `std::unique_ptr` wasn't available when JNI had been conceived…

It could be added…

The declaration in your sample still looks cumbersome… or _unwieldy_ as you 
said. Writing a custom deleter for each `jobject` doesn't look good either.

Most local references don't require explicit `DeleteLocalRef`, which also 
helps, I guess.

> Oops, you sent your correction about the custom deleter just as I sent my post

C++ has got many new features… I'm learning these feature on the fly since I 
don't use C++ as often.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/19867#issuecomment-2194699149

Reply via email to