Kava for GCJ?

Mohan Embar gnustuff@thisiscool.com
Sat Jul 5 13:01:00 GMT 2003


Hi People,

>Maybe this is a dumb question, but could you explain to me how
>Adam's code has the same visible effect for reference and value
>classes with your additional restrictions? Taking Adam's example
>one step further:
>
>    a.setState(Thing.HAPPY);
>    b.setState(Thing.SAD);

Oops, I missed this part:

Kees> >- All fields must be 'final'

...which would appear to make the setter calls illegal
(unless I've misunderstood something).

Given this, I'm not understanding the usefulness of
such value classes at all, given that an immutable
Java class accomplishes the same thing, albeit more
efficiently.

The restriction on fields being final definitely does
not hold for value classes (structs) in C#, for example.

Thanks for bearing with these questions.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/






More information about the Java mailing list