[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More finalize woes
From: |
Chris Gray |
Subject: |
Re: More finalize woes |
Date: |
Thu, 6 Mar 2003 10:50:39 +0100 (CET) |
On 5 Mar 2003, Tom Tromey wrote:
> >>>>> "Dalibor" == Dalibor Topic <address@hidden> writes:
>
> >> java.util.zip.[De|In]flater both have an empty finalize method "for
> >> compatibility". Is this really necessary?
>
> Dalibor> Yes, in order to have reflection on these methods
> Dalibor> working. A pretty good reason in my opinion.
>
> I'm not so sure. It seems to me that anybody using reflection has to
> be aware of, and understand, the Java binary compatibility rules.
> Implementing or not implementing finalize doesn't affect binary
> compatibility, so it should be a change we are free to make.
I think the main problem lies elsewhere. If you subclass a class which has
a finalizer and your subclass needs to do some finalization of its own,
then your finalizer needs to contain a call to super.finalize(). If the
published API doesn't show a finalizer then you wouldn't include this
statement. That's not an argument against trivial finalizers provided for
"compatibility", but it it's a strong argument agains non-trivial
finalizers where the public API has none: there's areal likelihood that
someone will subclass your class and fail to invoke your finalizer.
Regards
--
Chris Gray
VM Architect, ACUNIA
- More finalize woes, Jeroen Frijters, 2003/03/04
- Re: More finalize woes, Aaron M. Renn, 2003/03/04
- Re: More finalize woes, Dalibor Topic, 2003/03/04
- Re: More finalize woes,
Chris Gray <=
- Re: More finalize woes, Tom Tromey, 2003/03/06
- Re: More finalize woes, Sascha Brawer, 2003/03/06
- Re: More finalize woes, Artur Biesiadowski, 2003/03/06
- Re: More finalize woes, Stephen Crawley, 2003/03/06
- Re: More finalize woes, Per Bothner, 2003/03/06
- Re: More finalize woes, Stephen Crawley, 2003/03/06
- Re: More finalize woes, Stephen Crawley, 2003/03/06
- Re: More finalize woes, Per Bothner, 2003/03/06
- Re: More finalize woes, Stephen Crawley, 2003/03/06
- Re: More finalize woes, Per Bothner, 2003/03/07