There shouldn't be side-effects, unless you want your weak references to crash when they're null instead of throwing NullPointerExceptions. :-)
It turns out this was fixed four months ago
, just not closed. If you are building j2objc-generated code with ARC, then nothing needs to be done. If you don't build with ARC, compiling with the "-fobjc-weak" flag enables it. The good news is that I added "-fobjc-weak" to the flags Google apps that use non-ARC j2objc, and after four months there still aren't any reported issues.
Do you think we should require this compiler flag for non-ARC code? It seems much safer, with similar behavior as Java's WeakReference class. To require it, j2objc would have to generate the following for sources that have @Weak fields:
#if ! __has_feature((objc_arc_weak)
#error "@Weak annotations in non-ARC code require weak attribute support (-fobjc-weak)"
I'd also update j2objcc.sh and the docs to add that required flag.