November 20, 2008, 03:28:55 pm *
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Abstract serializable classes without a serialVersionUID field  (Read 1146 times)
Johan Stuyts
Newbie
*
Posts: 5


« on: August 16, 2007, 09:18:17 am »

Eclipse provides a warning for serializable classes that don't have a serialVersionUID. Unfortunately it does not do this for abstract classes, but they must have a serialVersionUID too as I found out the hard way.

The query below finds all abstract serializable classes without a serialVersionUID:
from Class c
where c.fromSource()
and c.hasModifier("abstract")
and exists(Interface s | s.hasQualifiedName("java.io", "Serializable") and c.hasSupertype+(s))
and not c.declaresField("serialVersionUID")
select c

Thanks for the great plugin!

Kind regards,

Johan Stuyts
Logged
Pages: [1]
  Print  
 
Jump to: