Java is pass-by-value. How could you modify the language to introduce passing by reference (or some equivalent behavior)?
Take for example something like
<
I think you can accomplish most of what you want by building an agent and using cglib.
Many of the examples given here can work. I'd recommend using the template you proposed because it will compile with the normal compiler.
public void doSomething(@Ref String var)
Then behind the scenes you use cglib to rewrite the annotated methods, which is easy. You'll also have to rewrite the caller, which i think will be much more complicated in cglib. javassist uses more of a "source code" oriented approach, and might be better suited for rewriting the callers.