[Mono-bugs] [Bug 672206] AvoidMethodWithUnusedGenericType should not be violated / should have severity reduced on a method that delegates the T to another method call

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 15 20:56:28 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=672206

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


Sebastien Pouliot <spouliot at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |spouliot at novell.com
         Resolution|                            |INVALID

--- Comment #1 from Sebastien Pouliot <spouliot at novell.com> 2011-02-16 01:56:26 UTC ---
That rule was a bit difficult to name (IMO fxcop equivalent is even more
confusing) and maybe the documentation could be better (suggestions welcomed)
although its example is a lot like your test case. Anyway the rule's goal is to
promote API that do not require caller to specify generic types.

By contrast your test case requires the caller to specify the type, which is a
defect as far as the rule is concerned, because that makes the API harder to
consume. Now if the generic type was used with one (or more) parameter(s) then
the compiler could infer it and the API could be used without specifying the
type (leading to a simpler to consume API, i.e. just like non-generic calls).

Personally I believe there are valid cases for such API (and Gendarme test
harness use some ;-). OTOH I understand that this is not something that should
be abused since it can, often, be avoided, hence the rule's pertinence.

Now FxCop only applies the rule to visible methods [1] because its 'FX' cop
(even if it slowly tends to get less FX, and more application, oriented). In
general Gendarme promotes that same rules, either externally for reusable
frameworks or internally inside applications, even if, in some cases, the
severity on non-visible code is reduced [2].

[1] you can configure Gendarme to skip non-visible code (for some, or all,
rules) to get a more FX-cop like behavior.
[2] which is not the case (presently) for this rule

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


More information about the mono-bugs mailing list