From: Lew on 29 Jan 2010 18:48 Lew wrote : >> The code convention document (not the JLS, though) suggests using all >> upper-case names only for class constants. The OP's code >> >> LOG.error(e.getMessage(), e); >> >> shows that 'LOG' is not a class constant. QED. Wojtek wrote: > In which way? Because LOG has a method? > > Then what about a String? It has methods. None of which are named 'error()'. Come on, people. -- Lew
From: Lew on 29 Jan 2010 18:52 Wojtek wrote: > I am not confused at all. If it is static and final, then it is a class > constant. The fact that it has attributes which can be modified (if > exposed) is a moot point. The _reference_ cannot be changed, and so it > is a constant. That is not the definition of a class constant! The JLS defines the term. It is an extremely important distinction; initialization of class constants and their storage differs from other 'static final' variables. You are not using the correct definition. <http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#10931> > We call a variable, of primitive type or type String, that is final and > initialized with a compile-time constant expression (§15.28) a constant > variable. Whether a variable is a constant variable or not may have > implications with respect to class initialization (§12.4.1), binary > compatibility (§13.1, §13.4.9) and definite assignment (§16). -- Lew
From: Lew on 29 Jan 2010 18:54 Peter Duniho wrote: > Joshua Block... It's Joshua Bloch, not Joshua Block. Get it right, please. -- Lew Bloch
From: Peter Duniho on 29 Jan 2010 19:13 Lew wrote: > Peter Duniho wrote: >> Joshua Block... > > It's Joshua Bloch, not Joshua Block. Get it right, please. Uh, I admit I misspelled his name. But, I simply used the same spelling John originally posted. Why single me out? Though, I admit…between the spelling of a person's name and the coding conventions used in code not relevant to an actual project you're working on, the former is much more worthy of mention. :p Pete
From: Lew on 29 Jan 2010 19:16
Peter Duniho wrote: >>> Joshua Block... Lew Bloch wrote: >> It's Joshua Bloch, not Joshua Block. Get it right, please. Peter Duniho wrote: > Uh, I admit I misspelled his name. But, I simply used the same spelling > John originally posted. Why single me out? I'm not singling you out, I just didn't feel like citing every single post that misspelled it, so I picked the most recent. If you hadn't made the same error, I'd've answered the earlier post. If John jumped off a bridge, would you do that, too? > Though, I admit…between the spelling of a person's name and the coding > conventions used in code not relevant to an actual project you're > working on, the former is much more worthy of mention. :p Especially if you happen to share the same surname. -- Lew |