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:
I don't understand why the exceptional post condition can't be established.
Thank you, for your help
Problem resolved,
my exception wasn't pure, with this code, it is working:
public /*@ pure @*/ MathLibException() {
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.