pcpratts/rootbeer1 — pull request #83 by ValeriyB (2013-03-11 22:19:50+00:00)
Title: Fix Autoboxing test

The root cause of the issue is the following. In AutoboxingRunOnGpu test variable Double m_result is not initialized and when the code is generated to restore it's value from heap the VisitorReadGen.makeReadForNullForType() is used. But this method uses a default constractor to create an object, while the Double type has no such constructor. So a check soot_class.declaresMethod("'void ()'") returns false and no bytecode is genrated. To fix the issue I propose to create a Double instanse using it's method Double.valueOf("0"). This will not only fix the issue for a Double but also for Float, Byte, Short, Long, Integer types. All of this types have valueOf(String) static method. Another possible solution is to create a 5 if-then-else construction and generate a diferent bytecode for each type (Double.valueOf(0.0d); Byte.valueOf((byte) 0); Integer.valueOf(0); But this is more complex and I do not see much benefits. BTW I removed the first check declaresMethod('void ()') because it's redundant: if no constructor is found then 'return nul' is generated - it's the same result when generator for a type not found.