and how would you resolve the problem?
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
Cheers,
Peter
Roshan Dawrani-2 wrote:
>
> As a matter of fact I wanted to explore on the lines that in static
> context
> this.foo always maps to getClass().foo and see what breaks in groovy code
> and what kind of issues crop up, and try to take the issue forward one way
> or another with the reasoning getting captured against the reported JIRA.
>
--
View this message in context: http://old.nabble.com/Groovy-way-to-invoke-Class-members-tp27282426p27287240.html
Sent from the groovy - user mailing list archive at Nabble.com.
Of course it is no requirement to report it, but is it a bug?
Assuming I have:
class A {
public static name = "xx"
public static foo = this.name
}
what value will foo have? Atm, this is supposed to be "xx", not the
class name. The idea for this compile error was, that if you did mean
what I wrote in my example but forgot the "static" for name, then you
will get an error message. An if we assume you really forgot the static,
then the error message is right too. Also, in the current version
this.name will directly access the field. If you change that to A.name,
and if there is a static name property, then the getter will get accessed.
And since we do the dynamic access if the field/property does not exist,
you could break older code... not that I expect that, but there is a
possibility.
Assuming I have:
class A {
public static name = "xx"
public static foo = this.name
}
what value will foo have? Atm, this is supposed to be "xx", not the class name.
The idea for this compile error was, that if you did mean what I wrote in my example but forgot the "static" for name, then you will get an error message. An if we assume you really forgot the static, then the error message is right too.
Also, in the current version this.name will directly access the field. If you change that to A.name, and if there is a static name property, then the getter will get accessed.
And since we do the dynamic access if the field/property does not exist, you could break older code... not that I expect that, but there is a possibility.