aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Compiler warnings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Compiler warnings" Watch "Compiler warnings" New topic
Author

Compiler warnings

Leszek Zajac
Greenhorn

Joined: May 18, 2006
Posts: 19
Hello.

I've almost finished my assignment.
During compilation of my application couple of warnings pop out:
- [unchecked] unchecked cast
- [unchecked] unchecked call to
- [unchecked] unchecked method invocation
I use -Xlint:unchecked,fallthrough,path,finally flags when compiling.

Should I care about these warnings?
Will they affect my grade?


Leszek
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
should you take care of them? certainly.
will they affect your grades? no way to know except trying and I for one don't want to try.

Least you can do is put in some @SuppressWarning annotations where appropriate, better yet handle the warnings whereever it makes even a bit of sense by solving what causes them.
Myself, I resorted to annotations ONLY to get rid of warnings relating to missing SerialVersionIds in my Swing related classes, as there's no intent whatsoever to ever serialise those.
Everything else, I provided a tight solution so there are no warnings to be suppressed.


42
Leszek Zajac
Greenhorn

Joined: May 18, 2006
Posts: 19
From now on I compile with -Xlint:all flag.

Did you use @SuppressWarnings("serial") for all
frames, control, tables, tablemodels, cellrenderers?
(Is TableModel a GUI class?)

PS. I have one more unchecked warning to eliminate :-)
Aleksander Zielinski
Ranch Hand

Joined: Nov 11, 2005
Posts: 127
Hi Leszek,

What do you mean by saying "is TableModel a GUI class"? Should it reside in GUI code, is that what you are asking about? Well, it all depends on your design. In mine where controller controls everything, controller creates table model every time new data is to be displayed and passes it to the view, so I can say it does not reside anywhere If you use MVC where model notifies view about changes then your table model should reside in the GUI code. Table model is not an application level model, it is the model on Swing level MVC design and its components.

Good luck on the exam, I plan to schedule mine just after New Year. Currently finishing my choices.txt and uploading after Christmas.
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
my custom TableModel (as part of the datamodel) did get one (a SerialVersionID that is), the visual classes (JTable descendents etc.) did not.
[ December 22, 2006: Message edited by: Jeroen T Wenting ]
Leszek Zajac
Greenhorn

Joined: May 18, 2006
Posts: 19
Thanks Olek.

My custom table model resides in gui package,
so it won't get serialVersionUID.
In my case the gui class creates table model when client starts.
Later it is filled with data, not recreated. It is not
part of application data model.
I have a thin client, so I don't have controller in it.

Originally posted by Aleksander Zielinski:
Good luck on the exam, I plan to schedule mine just after New Year. Currently finishing my choices.txt and uploading after Christmas.


I'm also planning to take the exam at this time. Good luck to you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiler warnings