[fedora-java] HelloWorld Example Won't compile

Charles Curley charlescurley at charlescurley.com
Wed Aug 24 04:04:40 UTC 2005


On Tue, Aug 23, 2005 at 11:16:21PM -0400, Andrew Overholt wrote:
> * Charles Curley <charlescurley at charlescurley.com> [2005-08-23 22:20]:
> >     [javac] ----------
> >     [javac] 1. WARNING in /home/ccurley/src/com/charlescurley/hello/src/HelloWorld.java
> > [...]
> >     [javac] The serializable class HelloWorld does not declare a static final serialVersionUID field of type long
> >     [javac] ----------
> >     [javac] 1 problem (1 warning)
> > 
> > What am I missing here?
> 
> Isn't that just a warning and not an error?  ecj is a little more
> particular than other bytecode compilers WRT serialVersionUIDs IIRC.
> 
> Andrew

I guess I'm a little picky about warnings. I learned way back when
ANSI C was all the latest rage that ignoring them was not a good
idea.

Anyway, turns out the solution is to declare the dang thing:


public class HelloWorld extends HttpServlet {
	static final long serialVersionUID = 0;


Now a C compiler (or lint) would have complained that it isn't
used. Sigh.

Thanks


-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/java-devel/attachments/20050823/b88a4f68/attachment.bin 


More information about the java-devel mailing list