Translation of the Object.finalize() into C# destructor
Brought to you by:
alexandrefau,
mauceric
I want to transform the finalize() method of every Object into the C# destructor notation : ~class_name(). (Note: C# does not allow to extend the method Finalize()).
For example :
class TestClass {
protected finalize() {
// ...
}
}
will translate to :
class TestClass {
~TestClass() {
// ...
}
}
So in the mapping i suggest to have a parameter telling the name of the resulting C# class (%C#_Class), and the mapping should be quite straight forward :
class java.lang.Object :: System:Object {
method finalize() { name = ~%C#_Class;}
}
So every finalize() method will translate into :
~class_name() {
...
}
In fact it is a bug because you can't rename the finalize method with ~ClassName because the ~ is not supported.
I think the translator should replace automatically finalize() by the destructor ~ClassName()