wuwbobo2021

Results 116 comments of wuwbobo2021

I am still being confused. Some says the Java memory model manages to define the behavior of data racing, and they cannot cause other well-known UBs in C/C++, but that...

> You are of course correct that UB affects the entire program in unpredictable ways, but in this case UB does not occur at all. I mean "unexpected behaviors affects...

Trying to make it a bit clearer: ```rust impl Test { fn test { use std::ops::Deref; let env = jni_get_vm().attach_current_thread().unwrap(); // What's the lifetime of `env` "'_" ? Setting it...

Actually, I found this bug while testing my `jni-min-helper` which uses `AutoLocal` frequently: a function may return a `AutoLocal` which can be used wrongly! It should return `GlobalRef` instead in...

I just found that changing `fn new_string(&self, s: &str) -> SRef SRef` should (probably) take `&'local self` or `&'local mut self`, instead of the implicit lifetime of `&self` or `&mut...

I just figured out why dangling `JObject` does not cause the segementation fault immediately in my test case, while `AutoLocal` does: - The JVM **may** return a pointer of the...

This is a simplified code snippet for demonstrating the problematic usage of `PhantomData`: ```rust use std::marker::PhantomData; // In a real-world project, S1 may wrap a pointer of some data to...

Note: this shouldn't be a bug of the Rust compiler. It's just that lifetime restrictions for raw pointer wrappers with `PhantomData` should specify the lifetime requirement in function signatures, otherwise...

Well, I just found that my `fn deref_mut_custom(&'local mut self) -> &'local mut Self::Target;` (based on https://github.com/jni-rs/jni-rs/issues/558#issuecomment-2609771654) means an unusable API! ```rust struct Test; impl Test { fn do_something_2(&self) {...

My previous understanding is that dropping the `AttachGuard` may detach the thread from the JVM, thus having a local reference that outlives the guard is a UB. (Actually, the lifetime...