Added patch to gen_java.py to generate delete method to replace finalize