Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Why use RevWalk dispose()?

Martin Fick wrote:

It is not clear to me from the jgit docs when one would use the RevWalk
dispose() method?  The docs explain what it does but that gives me very little
idea of why I should use it.  Many examples on the net do use it.  The
AutoCloseable close() method seems to be the normal thing to do after using a
RevWalk, so why is there a dispose(), and when should it be used?

I think we should deprecate it. dispose() came first --- the AutoCloseable close() is simpler but came later.

There is a slight difference in semantics, in that dispose() releases the ObjectReader even when the RevWalk doesn't own it, but in that scenario I think it's better for the caller to be explicit.

Thanks,
Jonathan

Back to the top