Re: Check for serialVersionUID in Serializableclasses

"Roman Scheiter" <[email protected]>
Newsgroups gmane.comp.java.audit.checkstyle.user
Message-ID <[email protected]>
Thanks for the suggestions. I spent some time today looking at both,
findbugs and javac lint checks. Either suits my needs and integrates
nicely with Hudson.

 

Thanks for the suggestions.

Roman

 

 

________________________________

From: [email protected]
[mailto:[email protected]] On Behalf Of
Oliver Burn
Sent: Tuesday, July 01, 2008 11:41 PM
To: [email protected]
Subject: Re: [Checkstyle-user] Check for serialVersionUID in
Serializableclasses

 

Given the need for deep type information, I would look at FindBug. Only
if -Xlint:serial is not enough. :-)

On Wed, Jul 2, 2008 at 04:53, Edelson, Justin
<[email protected]> wrote:

I don't know about #4, but doesn't -Xlint:serial do #1 - #3?

 

Justin

 

________________________________

From: [email protected] on behalf of Roman
Scheiter
Sent: Tue 7/1/2008 2:40 PM
To: [email protected]
Subject: [Checkstyle-user] Check for serialVersionUID in Serializable
classes

Hi,

 

I am in need of a check that verifies that all of the classes
implementing the Serializable interface have the serialVersionUID
defined.

Trolling through the plenty available checks, I did not see such a check
being available today. I also noticed that there is a request for such
check in the bug tracking system.

If anyone has a check for this, please let me know and point me to it.

 

I have started writing my own check. The scenarios that I would need to
cover are:

1. Class implements Serializable interface, validate that
serialVersionUID is assigned

2. Class implements InterfaceA which extends Serializable, validate that
serialVersionUID is assigned

3. Class extends ClassA which implements Serializable (or Interface A),
validate that serialVersionUID is assigned.

4. Class implements Serializable through type hierarchy, but is not
serializable, i.e. throws NotSerializableException for read/writeObject,
do not require serialVersionUID.

 

Item 1 is very straight forward and I can put this together following
the "Write a Check" tutorial. I am not clear how I can establish and
examine the Type hierarchy.

 

Does anyone have suggestions as to how this Check can be implemented? Is
this something that can be accomplished using the FileSetChecks?

 

Thanks for the help,

Roman 

 


------------------------------------------------------------------------
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08

_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.