Make type lookup safer

Issue #46 resolved
Jesper Öqvist created an issue

The lookupType attribute can return null. The attribute should be made safer by instead returning UnknownType.

Comments (2)

  1. Jesper Öqvist reporter

    In most cases the result of lookupType is checked for nullness, however some standard type lookups are not null-checked, for example the ones below:

    syn lazy TypeDecl Program.typeObject() = lookupType("java.lang", "Object");
    syn lazy TypeDecl Program.typeCloneable() = lookupType("java.lang", "Cloneable");
    syn lazy TypeDecl Program.typeSerializable() = lookupType("java.io", "Serializable");
    

    Normally these types will be available, but if they for some reason are not (misconfigured boot classpath) then we get a NullPointerException.

  2. Log in to comment