[Soot-list] Mutable BlockGraph

shmohtasham at gmail.com shmohtasham at gmail.com
Thu Feb 5 20:45:01 EST 2009


Thanks Eric.

Turns out that the list of blocks in BlockGraph is an  
"unmodifiableList" collection.
I found out about this when I got "UnsupportedOperationException" when
trying to call remove on the list returned from BlockGraph.getBlocks().

If what I observed is true, then writing a subclass of BlockGraph  
wouldn't
help either, because the list is immutable; unless the "buildBlocks"  
method is
overridden, which is probably the last thing I want to do :)

--Hossein


On 5-Feb-09, at 4:58 PM, Eric Bodden wrote:

> Looking at BlockGraph, it seems that all of the members have default
> visibility, but in fact probably should be protected so that they can
> easily be mutated by subclasses. I guess that would solve your
> problem. I will make appropriate changes and commit them.
>
> If you want to use the current version of Soot then you can use a
> hack: All accessor methods in BlockGraph return references to the
> internal data structures, not copies. Hence you can just call
> blockGraph.getBlocks().add(..) etc.
>
> Does that help?
>
> Eric
>
> 2009/2/5  <shmohtasham at gmail.com>:
>> Hi,
>>
>> I'd like to change a BlockGraph but i could not find any mutable  
>> block
>> graph in soot. There are some mutable directed graph
>> utility classes (e.g. HashMutableDirectedGraph) but there's no easy
>> way to make a BlockGraph again (after changing it) from
>> a mutable graph.
>>
>> So, I was wondering what would be the best way to edit a BlockGraph  
>> on
>> the fly (add/remove nodes/edges) in soot? I mostly
>> mean an easier way than having to implement a mutable block graph!
>>
>> Thanks in advance for your time.
>>
>> --Hossein
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>
>
>
> -- 
> Eric Bodden
> Sable Research Group, McGill University
> Montréal, Québec, Canada

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090205/12aeab1a/attachment.html 


More information about the Soot-list mailing list