Menu

#31 NullPointerException in com.ibm.wala.cast.loader.AstMethod

open
CAst (9)
8
2008-04-21
2008-04-18
No

In WALA release 1.1.2, the method com.ibm.wala.cast.loader.AstMethod.getNumberOfParameters() causes a NullPointerException when the AstMethod is created via the "abstract" constructor. In this situation, the field [AstMethod.symtab] is null, and the method performs a deref on [symtab] without checking if it is null. No solution is proposed because I wasn't sure if the call should be disallowed in this situation and an exception should be raised, a negative value should be returned denoting a problem, or if the class needs to be reworked so that it has a valid [symtab] field even when the [AstMethod] represents an abstract method. Can be reproduced by analyzing a test file like that given below, and printing the number of parameters for all methods in the class hierarchy.

public abstract class X {
public abstract void foo(int i);
}

Discussion

  • Stephen Fink

    Stephen Fink - 2008-04-21
    • priority: 5 --> 8
    • assigned_to: nobody --> dolby-oss
     
  • Stephen Fink

    Stephen Fink - 2008-04-21
    • labels: 892720 --> CAst