All | 43 Folders | Accessibility | BoingBoing | Books | Computer Related | Family | Films | General | Hacking | Hobbies | Humor | Java | Links | Omni | OpenSolaris | Puzzles and Games

« Links to my java.net... | Main | Kill Bill »
20040621 Monday June 21, 2004

Java, now with builtin lint.

A couple of weeks ago, I got a chance to see Josh Bloch and Neal Rafter do one of the talks they will be giving at JavaOne this year. This was in the Auditorium at the Santa Clara campus, and was for Sun employees who might not get a chance to go to the conference sessions at JavaOne.

The talk described the new features in J2SE 1.5.0 (which is currently available in beta2).

Lots of great stuff, but something that caught my ear was that the "javac" command now has a -Xlint option that provides lint style output of your Java code.

Cool. So I tried this on JSDT, a Java collaboration toolkit that I wrote, just to see what it would pick up on. I always run lint on my C code, so it's nice to automatically have something similar for Java (yes, I know about Java lint but it's not quite the same thing).

Well first javac in J2SE 1.5 wouldn't compile my code because I was using "enum" as a variable name, and it's now a keyword in the language. That was an easy one to fix. After it successfully compiled, it started giving me lint messages. Lots of them. They boiled down to the following three types:

Nothing life threatening, but they should be easy to fixup. Thanks for adding this facility to the compiler.

[]

[]

( Jun 21 2004, 09:50:51 AM PDT ) [Listen] Permalink Comments [4]

Comments:

How did you get rid of those warnings when we give the option of -Xlint using Java 1.5.0 Thanks Srini

Posted by Srini on August 27, 2004 at 12:38 PM PDT #

Hi Srini. Do you mean, what changes did I have to make to my code in order to fix the warnings?

Posted by Rich Burridge on August 27, 2004 at 06:00 PM PDT #

I also want to know how to change the code to make these warning messages disappear?

Posted by Meifeng on September 30, 2004 at 12:14 PM PDT #

Meifeng, I suggest a little googling around to find the answers. For example, I searched for "definition of serialVersionUID" for the first warning, and got a good hit here

Posted by Rich Burridge on September 30, 2004 at 12:48 PM PDT #

Post a Comment:

Comments are closed for this entry.