[Soot-list] Soot typing issue: local gets the null_type

Stephen Neuendorffer stephen.neuendorffer at xilinx.com
Wed Apr 5 19:14:14 EDT 2006


I've run into this same problem in the context of using Soot to generate
java code.
A bug in the code generator might result in exactly the code below,
which (if I recall)
typically results in generating bogus java code (rather than simply code
which
throws a NullPointerException).

Although it's nice to find out statically that this code will always
throw a
NullPointerException, it would be nice to continue gracefully and
generate
code that can then be debugged.  I never discovered an elegant solution
other than
being very careful to treat NullType as a possible receiver of every
method and 
detecting the condition myself before generating Java code.

Steve 

> -----Original Message-----
> From: soot-list-bounces at sable.mcgill.ca 
> [mailto:soot-list-bounces at sable.mcgill.ca] On Behalf Of Patrick LAM
> Sent: Wednesday, April 05, 2006 2:35 PM
> To: Todd Wallentine
> Cc: soot-list at sable.mcgill.ca
> Subject: Re: [Soot-list] Soot typing issue: local gets the null_type
> 
> On Wed, 5 Apr 2006, Todd Wallentine wrote:
> 
> > Here is some sample code that shows this behavior:
> > public class Test {
> >          public static void main(String[] args) {
> >                  Foo f = new Foo();
> >                  f = null;
> >                  f.inc();
> >          }
> > }
> 
> Hi Todd,
> 
> The Soot typing code is correctly deducing that f.inc() will 
> occur on 'null'.  It could, of course, deduce a more general 
> type, but I understand that the Soot typing algorithm will 
> deduce the narrowest possible type, which is 'null' in this case.
> 
> Is it possible to make Bandera handle null types 
> appropriately?  That would seem to be the best solution.  The 
> input code isn't especially meaningful either, as it'll 
> always result in a NullPointerException.
> 
> pat
> 
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> 
> 



More information about the Soot-list mailing list