Leo Simons challenged me a while back to do super-clean object pooling via aspects. I couldn't quite get it, but I tried. I fired up Þe old IDEA and got a step closer today. Still haven't gotten around the new function declaring a type for its return value yet,though. I mean, you call new Foo() and expect an actual instance of Foo. How unreasonable is that? But I digress.
The ReleaseManager class returns a proxy implementing all the interfaces of a class, and allows for the detection and registration of callbacks (which receive the real instance) for when the proxy falls out of scope. Nothing fancy here, most (good) pooled DataSource implementations do this now for Connection instances they loan out.
The fun part is applying an aspect to capture and do this for you to provide "transparent pooling". There is still a problem of needing a GC to force return to the pool. Additionally, you cannot capture on public Mammal+.new(..) and return anything other than a correct instance of the class being newed (maybe you could return a subclass, which opens up the possibility of cglib proxies, but that has heavy-object ramifications).
I'm still thinking about it, Leo, and I am exceptionally stubborn =)