RE: Javadoc misprint for DefaultListSelectionModel
"Christian Cryder" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
> "Every field declaration in the body of an interface is implicitly > public, static, and final. It is permitted to redundantly specify any or > all of these modifiers for such fields." (Java Language Specification, > 2nd ed. section 9.3) > > So apparently if a compiler follows the specification then the concern > Jake had about memory consumption doesn't apply. I agree, however, that > for the sake of explicitivity (is that a word?) we should declare them > public static final. Yeah! That's what I meant! You just stated it much more nicely than I did :-) Christian ---------------------------------------------- Christian Cryder [[email protected]] Internet Architect, ATMReports.com Barracuda - http://barracudamvc.org ---------------------------------------------- "Coffee? I could quit anytime, just not today" > -----Original Message----- > From: [email protected] > [mailto:[email protected]]On Behalf Of Shawn Wilson > Sent: Monday, May 05, 2003 5:59 PM > To: [email protected] > Subject: Re: [Barracuda] Javadoc misprint for DefaultListSelectionModel > > > Just a quick comment about your quote... > > > As I think about it though, I'm surprised it even compiles > without being > > declared final static: "The only fields allowed in an interface > > definition are constants that are declared both static and final" (Java > > in a Nutshell, 4th ed. p118). It wouldn't surprise me at all if under > > the covers these variables actually are being compiled as static finals > > (that's really the only way they make sense in an interface). At any > > rate...its not a big issue (just interesting ;-)...I'd say go ahead and > > chnage it. > > That is all true, though you should not be surprised that it compiles. > It compiles just fine because: > > "Every field declaration in the body of an interface is implicitly > public, static, and final. It is permitted to redundantly specify any or > all of these modifiers for such fields." (Java Language Specification, > 2nd ed. section 9.3) > > So apparently if a compiler follows the specification then the concern > Jake had about memory consumption doesn't apply. I agree, however, that > for the sake of explicitivity (is that a word?) we should declare them > public static final. > > -shawn > > Christian Cryder wrote: > > First of all I agree with you, we should change it. > > > > As I think about it though, I'm surprised it even compiles > without being > > declared final static: "The only fields allowed in an interface > > definition are constants that are declared both static and final" (Java > > in a Nutshell, 4th ed. p118). It wouldn't surprise me at all if under > > the covers these variables actually are being compiled as static finals > > (that's really the only way they make sense in an interface). At any > > rate...its not a big issue (just interesting ;-)...I'd say go ahead and > > chnage it. > > > > Regarding nuking code that has been commented out. As a general rule, > > when I am working on classes I leave the original code in there (albeit > > commented out) to make it easier to track down problems if they arise - > > I can see what was there before, how it got changed, etc. This makes > > sense in classes that get modified with a fair degree of frequency. > > However, for classes that are either a) undergoing massive rewrites, in > > which there's really not much comparison between old and new > code, or b) > > haven't changed in a long time, then I think its fine to clean > things up > > from time to time. > > > > DefaultListSelectionModel falls into b...it hasn't been changed in a > > long time, I'd wager, so if you want to clean things up a bit, > feel free. > > > > Hope that helps... > > Christian > > > > ---------------------------------------------- > > Christian Cryder [[email protected]] > > Internet Architect, ATMReports.com > > Barracuda - http://barracudamvc.org <http://barracudamvc.org/> > > ---------------------------------------------- > > "Coffee? I could quit anytime, just not today" > > > > -----Original Message----- > > *From:* [email protected] > > [mailto:[email protected]]*On Behalf Of *Jacob Kjome > > *Sent:* Monday, May 05, 2003 4:22 PM > > *To:* [email protected] > > *Subject:* RE: [Barracuda] Javadoc misprint for > > DefaultListSelectionModel > > > > > > They may be effectively final, but not static. Currently, each > > variable would take up more memory space for every > > ListSelectionModel object that is created unless they are defined as > > static. Making them final also allows the compiler to perform > > optimizations....unless the compiler sees it is an interface and > > treats everything like static final, but I am not aware of that and > > It probably wouldn't be required of a java compiler. No reason I > > see not to be explicit about it? > > > > BTW, there is a *ton* of code commented out in > > DefaultListSelectionModel. Is there any particular reason to keep > > it there? If we remove it, the original code will continue to exist > > in CVS, so it isn't like it is lost for good. If it isn't used and > > there are no comments saying "please do not delete", then I think it > > would make sense to just clean it up. Any objections? > > > > Jake > > > > At 01:46 PM 5/5/2003 -0400, you wrote: > > > >> No objections, but its actually a moot point, since > >> ListSelectionModel is an interface, so any variables declared > >> therein effectively are static final (whether they are declared > >> that way or not). > >> > >> Christian > >> ---------------------------------------------- > >> Christian Cryder [[email protected]] > >> Internet Architect, ATMReports.com > >> Barracuda - http://barracudamvc.org <http://barracudamvc.org/> > >> ---------------------------------------------- > >> "Coffee? I could quit anytime, just not today" > >> > >> -----Original Message----- > >> From: [email protected] > >> [mailto:[email protected]]On Behalf Of > Jacob Kjome > >> Sent: Monday, May 05, 2003 1:23 PM > >> To: [email protected] > >> Subject: Re: [Barracuda] Javadoc misprint for > >> DefaultListSelectionModel > >> > >> > >> Oh, ok, I thought you were a committer. I'll make the > >> change. BTW, shouldn't SINGLE_SELECTION, > >> SINGLE_INTERVAL_SELECTION, and MULTIPLE_INTERVAL_SELECTION be > >> static variables in ListSelectionModel? They aren't > >> currently. I don't see why not? Actually, they should also > >> be final. > >> > >> Any objections to making them static final? > >> > >> Jake > >> > >> At 10:57 AM 5/5/2003 -0600, you wrote: > >> > >>> Yes that's right... I however am not a commiter so I > >>> don't have access to check in changes to source files. > >>> > >>> -shawn > >>> > >>> Jacob Kjome wrote: > >>> > >>>> Hi Shawn, > >>>> Go ahead and make the change. It is just a Javadoc > >>>> correction, right? > >>>> > >>>> Jake > >>>> At 10:03 AM 5/5/2003 -0600, you wrote: > >>>> > >>>>> Hey guys, just wanted to let someone know that > >>>>> there is some incorrect information in the > >>>>> javadoc comments for DefaultListSelectionModel. > >>>>> Specifically, the comments for > >>>>> setSelectionMode() claim "the default it > >>>>> MULTIPLE_INTERVAL_SELECTION". However, after > >>>>> wondering why my BSelect wasn't working and > >>>>> then looking at the source I see that should > >>>>> actually say "SINGLE_SELECTION". > >>>>> > >>>>> -shawn > >>>>> > >>>>> _______________________________________________ > >>>>> Barracuda mailing list > >>>>> [email protected] > >>>>> http://barracudamvc.org/lists/listinfo/barracuda > >>> > >>> > >>> _______________________________________________ > >>> Barracuda mailing list > >>> [email protected] > >>> http://barracudamvc.org/lists/listinfo/barracuda > > _______________________________________________ > Barracuda mailing list > [email protected] > http://barracudamvc.org/lists/listinfo/barracuda