« Return to Thread: Why is addError method on ClassCodeVisitorSupport and not parent CodeVisitorSupport?

Re: Why is addError method on ClassCodeVisitorSupport and not parent CodeVisitorSupport?

by Jochen Theodorou :: Rate this Message:

Reply to Author | View in Thread

Hamlet D'Arcy schrieb:

> Why is addError method on ClassCodeVisitorSupport and not parent
> CodeVisitorSupport?
>
> ClassCodeVisitorSupport is a subtype of CodeVisitorSupport.
> ClassCodeVisitorSupport defines addError, which is useful to add
> errors to the SourceUnit.
>
> Is there any reason this isn't pulled up into CodeVisitorSupport,
> beyond that it would then require that class to hold a reference to
> SourceUnit?

the reference to SourceUnit is hold by he abstract method
getSourceUnit(), which every subclass of that visitor has to implement.

Moving getSourceUnit and addError up into CodeVisitorSupport means to
possibly break existing code because getSourceUnit is abstract and
addError requires the SourceUnit.

bye blackdrag

--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Why is addError method on ClassCodeVisitorSupport and not parent CodeVisitorSupport?