JML - OpenJML with Extended Static Checking - Array Example

320 Views Asked by At

I just started to use OpenJML, here my code and my JML warning:

Code :

//@ requires myArray != null ;
//@ ensures myArray == \old(myArray) ;
//@ signals ( MathLibException ) myArray.size() == 1 ;
public ArrayList<Integer> ExceptionTest1 (ArrayList<Integer> myArray) throws MathLibException
{
    if ( myArray.size() == 1  )
    {
        throw new MathLibException();
    }
    else
        return arraylist;
}

JML warnings :

JML warnings

I don't understand why the exceptional post condition can't be established.

Thank you, for your help

1

There are 1 best solutions below

0
On

Problem resolved,

my exception wasn't pure, with this code, it is working :

    public /*@ pure @*/ MathLibException() {
}