1 Dec 2010 17:07
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)
RSS Feed