Additional -Xlint:serial warning
Florian Weimer
fweimer at bfk.de
Wed Aug 4 15:24:10 UTC 2010
* Neal Gafter:
> Unfortunately, many inner classes are only "incidentally" serializable -
> that is, they are serializable because the superclass or some implemented
> interface extends Serializable. A simple example would be an inner
> exception class - even though most programs do not serialize exceptions,
> this would trigger the proposed diagnostic.
Inner exception classes probably should be non-static. And many
incidentally serializable classes already receive a warning under
-Xlint due to a missing serialVersionUID field.
If necessary, the warning could be restricted to classes with a
declared serialVersionUID member, or class definitions explicitly
implementing the Serializable interface.
(I spent a few hours hunting down a bug caused by a mismatch between
this$0 and this$1, that's why I think something should be done about
it.)
--
Florian Weimer <fweimer at bfk.de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99
More information about the core-libs-dev
mailing list