jastrachan | 22 Jul 09:50 2004
Picon

Re: rss reserved?

We should definitely fix this error message to be more meaningful - 
like adding something like

     'is your script named 'rss' or do you have a class called 'rss' on 
the classpath?'

On 22 Jul 2004, at 05:25, Christopher M. Judd wrote:
> Woops. My groovy script was named rss.
>
>  
>
> -----Original Message-----
> From: bing ran [mailto:bran@...]
>  Sent: Wednesday, July 21, 2004 11:23 PM
> To: user@...
> Subject: RE: [groovy-user] rss reserved?
>
>  
>
> Chances are your code is in rss.groovy, which compiles to rss.class, 
> thus the conflict. Currently the compiler will attempt to resolve any 
> variable to see if it stands for a class name. As a general style 
> guide I'd suggest using a file name that starts with an upper case. 
>
>  
>
> Basically following the naming conventions of Java would lessen 
> surprises.
>
>   
>
>  
>
>  
>
>
> From: Christopher M. Judd [mailto:cjudd@...]
>  Sent: Thursday, July 22, 2004 12:00 PM
> To: user@...
> Subject: [groovy-user] rss reserved?
>
> Does the variable rss mean something special to Groovy? I got an 
> exception when I tried to assign a value to it. I change the variable 
> name to something else such as bbb and it works fine. See the sample 
> code and exception below.
>
>  
>
> Sample code:
>
>  
>
> url = new URL(url)
>
> rss = url.openStream()
>
> println "${rss}"
>
>  
>
> Exception:
>
>  
>
> org.codehaus.groovy.syntax.parser.RuntimeParserException: Cannot use a 
> class expression on the left hand side of an assignment. Node: 
> org.codehaus.groovy.ast.expr.MethodCallExpression <at> cbf30e[object: 
> org.codehaus.groovy.ast.expr.VariableExpr
>
> ession <at> 1c247a0[variable: url] method: openStream arguments: 
> org.codehaus.groovy.
>
> ast.expr.TupleExpression <at> 1ec6696[]]. At [15:21] 
> F:\temp\groovy\rss.groovy
>
>         at 
> org.codehaus.groovy.classgen.AsmClassGenerator2.throwException(AsmCla
>
> ssGenerator2.java:1678)
>
>  
>
> -----------------------------------------------
>
> Christopher M. Judd
>
> Judd Solutions, LLC
>
> President & Consultant
>
> Co-author of Enterprise Java Development on a Budget
>
>  
>
> 685 Farrington Dr.
>
> Worthington, OH 43085
>
> phone: 614-378-4119
>
> email: cjudd@...
>
> web: www.juddsolutions.com
>
>  
>

James
-------
http://radio.weblogs.com/0112098/


Gmane