Jochen Theodorou | 1 Dec 2010 17:07
Picon
Gravatar

Re: [groovy-dev] DeclarationExpression.getVariableExpression should be deprecated?

Hamlet DArcy wrote:
> Back to the discussion of DeclarationExpression... 
> 
> This object has the following API: 
> 
> class DeclarationExpression 
>   - DeclarationExpression(Expression, Token, Expression) - For this constructor the left expression
_must_ be of type VariableExpression or a TupleExpression with one or more elements. 
>   - getVariableExpression() : VariableExpression - as we discussed, this can throw a ClassCastException
>   - isMultipleAssignmentDeclaration() - returns true if the left hand side is a ArgumentListExpression

looking at your changes the last one should be TupleExpression ;)

> So...
> 
> I added deprecated to getVariableExpression() and we found two bugs
> in Groovy. Both have JIRAs. However, the isMultipleAssignmentDeclaration()
> method does exist, and there is a safe way to work with this object.
> 
> I think we should remove the deprecation and write better javadoc for
> the object. Since the API allows safe usage there is no need for a
> deprecation. I did this already but have not checked in. What do you think?

ok I think.

> Second issue: It is possible to create a DeclarationExpression with a TupleExpression that is _not_ an
ArgumentListExpression. In this case isMultipleAssignmentDeclaration() returns false but
getVariableExpression() still throws an exception. I believe we should change the implementation of
this method from: 
>     public boolean isMultipleAssignmentDeclaration() {
(Continue reading)

Hamlet DArcy | 1 Dec 2010 17:54
Favicon

Re: [groovy-dev] DeclarationExpression.getVariableExpression should be deprecated?

> One more question though... can the Ast UI now make something usefull
> out of null or not? For example what if the rightExpression is null?
> what if the rightExpression is an EmptyExpression?

Yes, I handles nulls just fine, as well as EmptyExpressions. 

--
Hamlet D'Arcy
hamlet.darcy@...

----- Original Message -----
> Hamlet DArcy wrote:
> > Back to the discussion of DeclarationExpression...
> >
> > This object has the following API:
> >
> > class DeclarationExpression
> >   - DeclarationExpression(Expression, Token, Expression) - For this
> >   constructor the left expression _must_ be of type
> >   VariableExpression or a TupleExpression with one or more elements.
> >   - getVariableExpression() : VariableExpression - as we discussed,
> >   this can throw a ClassCastException
> >   - isMultipleAssignmentDeclaration() - returns true if the left
> >   hand side is a ArgumentListExpression
> 
> looking at your changes the last one should be TupleExpression ;)
> 
> > So...
> >
> > I added deprecated to getVariableExpression() and we found two bugs
(Continue reading)


Gmane