Tweak for protected and private destructor wrapping

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4886 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-06-11 09:15:06 +00:00
commit 10578504db

View file

@ -1096,23 +1096,23 @@ class CSHARP : public Language {
else else
tm = javaTypemapLookup("csdestruct_base", classDeclarationName, WARN_NONE); tm = javaTypemapLookup("csdestruct_base", classDeclarationName, WARN_NONE);
// Emit the finalize and Dispose methods // Emit the Finalize and Dispose methods
if (*Char(destructor_call) && tm) { if (tm) {
Printv(destruct, tm, NIL); // Finalize method
Replaceall(destruct, "$jnicall", destructor_call); if (*Char(destructor_call)) {
// finalize method Printv(shadow_classdef,
Printv(shadow_classdef, javaTypemapLookup("csfinalize", classDeclarationName, WARN_NONE),
javaTypemapLookup("csfinalize", classDeclarationName, WARN_NONE), "\n",
"\n", NIL);
NIL);
// Dispose method
if (*Char(destruct)) {
Printv(shadow_classdef, " public ", derived ? "override" : "virtual", " void Dispose() ", destruct, "\n", NIL);
} }
} else { // Dispose method
// Ensure method exists for derived class to call. Don't bother if the typemap doesn't exist. Printv(destruct, tm, NIL);
if (tm && *Char(tm)) if (*Char(destructor_call))
Printv(shadow_classdef, "\n protected ", derived ? "override" : "virtual", " void Dispose() {\n }\n", NIL); Replaceall(destruct, "$jnicall", destructor_call);
else
Replaceall(destruct, "$jnicall", "throw new MethodAccessException(\"C++ destructor does not have public access\")");
if (*Char(destruct))
Printv(shadow_classdef, " public ", derived ? "override" : "virtual", " void Dispose() ", destruct, "\n", NIL);
} }
Delete(destruct); Delete(destruct);