Author Login
Post Reply
Hi Everybody,
I wrote something along the lines:
public class Text{
// Stuff coming from the outside, settable but also gettable
String value = ""
// internal state
private String document = null
def p() {
println "document intern: $document"
}
}
def tt = new Text(value:"val", document: "impossible")
tt.p()
println tt.value
println tt.document
Should't the initialization of the private "document" be forbidden and the
access via tt.document even more? I found a thread bout this somewhere but
at some point Barzilai Spinak-2 points out (citation on) "When we are
talking about "private member" in Groovy, we are talking about a statically
defined member (not necessarily statically typed, but it's a field/attribute
that's defined in code). For those member fields, Groovy generates get/set
methods. But when they are private, it doesn't generate them." (citation off
from http://www.nabble.com/forum/ViewPost.jtp?post=13103259&framed=y)
I don't get the point, why I can access it. I just figured out by accident
using Groovy 1.6 - beta - 1
Thanks for clarification
Uwe
--
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email