Skip to content

Regnant crashes on simple null check assertion. #7

@aigarashi

Description

@aigarashi

When we pass the following Java code into regnant:

public class NullCheck {
    public static void main(String[] args){
        String s = null;
        assert(s != null);
    }
}

The current implementation of regnant will output code which looks like this:

NullCheck_main(){
  ifnull null then {
    fail;
  }else{
    return 0
  }
}

{ NullCheck_main() }

ifnull null seems to be the cause of the error.
However, modifying the semantics of ConSORT seems to mess with ownership and may cause issues.

Modifying how ConditionExpr gets treated with null literals in regnant (src/main/java/edu/kyoto/fos/regnant/translation/Translate.java ) outputs the following ConSORT:

NullCheck_main(){
  {
    fail;
    return 0
  }

}

{ NullCheck_main() }

This also fails with line 2, col 2 in file mono.imp: Dead code.
There's probably a better way to generate the code when we hit this case so that we don't generate the "dead code".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions