[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how should Chain.iterator(n,n-1) work?
Hi John,
John Jorgensen <jorgnsn@lcd.uregina.ca> wrote:
> I've just diagnosed a bug in my code which I strongly suspect
> exists in other parts of Soot, and I'm looking for counsel on how
> to deal with it.
>
> My bug was due to an iterator created like this:
>
> Iterator unitIt = units.iterator(trap.getBeginUnit(),
> units.getPredOf(trap.getEndUnit());
>
> which misbehaves for empty Traps, where getBeginUnit() == getEndUnit(),
> since in the call to
Just to nitpick. You wrote in your last commit:
------------
Documentation fixes to clarify that Trap.getEndUnit() is the
first untrapped Unit, not the last trapped Unit.
------------
Looking at the actual updated documentation in Trap.java, I conclude
that Trap.getBeginUnit() is a trapped Unit and that Trap.getEndUnit()
is an untrapped Unit.
So how can getBeginUnit() == getEndUnit()?
Of course, I'm guessing this happens in the boundary condition where
there's no Unit following the last trapped Unit but one might not
think of that looking at the documentation.
Cheers,
Navin.