[Mono-bugs] [Bug 337399] monodoc will generate documentation for protected members of sealed classes

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 28 15:28:00 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=337399#c1


Jonathan Pryor <jonpryor at vt.edu> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |jonpryor at vt.edu




--- Comment #1 from Jonathan Pryor <jonpryor at vt.edu>  2007-10-28 13:27:59 MST ---
This is not a bug.

1. Consider:

    public abstract class Type {
        public bool HasElementType {
            get {return HasElementTypeImpl ();}
        }
        protected abstract bool HasElementTypeImpl ();
    }

    public sealed class MyType : Type {
        protected override bool HasElementTypeImpl ()
        {
            return false;
        }
    }

The point is this: just because it's a protected member of a sealed class does
NOT mean that no external code can call it.  The only way to be sure would be
to do lots of code-flow analysis to find patterns like the above.

2. monodoc doesn't use Mono.Cecil, or anything like Mono.Cecil, and thus does
not do any code flow analysis.

Given those two facts, your test case *should* have documentation generated for
ConcreteClass.foo.

Even after monodocer is migrated to use Cecil -- which has no timeframe -- it
is unlikely that such code flow analysis will be performed.  I'd prefer the
code flow analysis be in Gendarme, not monodocer.

However, one similar case that perhaps should be handled are
*non*-virtual/abstract protected members on sealed classes:

    public sealed class Demo {
        protected void Foo () {}
    }

monodocer currently generates documentation for Demo.Foo(), even though there
is no possible way for Foo() to be overridden or directly invoked (w/o using
Reflection).

I'm leary of adding such special-case support, though, as the intention may be
to make Demo non-sealed in a future release, in which case Demo.Foo should be
documented.

Furthermore, why would `protected' be used here instead of `private' anyway?  I
doubt that this happens all that frequently in real code (though I'd love to be
proven wrong).


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list