I need to set up a postcondition that guarantees null return if size_ is 0. Based on
if(size_ == 0) return null;
how can i do this in jml? any ideas? The following does not work:
//@ ensures size_ == null ==> \return true;
early
Try
//@ ensures size_ == null ==> \result == true;
Example:
//@ ensures size_ == null ==> \result == true; public boolean sizeUndefined() { if (size_ == null) return true; return size_.length() > 0; }
You can also simply write it like this:
//@ ensures size_ == null ==> \result;
Here is the documentation for\result :
\result
3.2.14 \result\result , . , . \result , , , , .
: size_, Object primitive(int)?
size_
Object
primitive(int)
-, ? Object primitive(boolean)?
primitive(boolean)
null null, . , size_ int, return boolean, -
null
int
boolean
//@ ensures size_ == 0 ==> \result;
Source: https://habr.com/ru/post/1778690/More articles:Как я могу получить доступ к паролю iPhone в приложении - objective-cHow to find the pixel coordinates of the corners of a square pattern? - language-agnosticWhat is the IIS equivalent of these rewrite rules? - url-rewritingMongoid - query by reference document - ruby | fooobar.comHow much data (lots of MB) I can uniquely identify with MD5 - securityselect () returns an invalid argument - cTimeout task in a distributed transaction over WCF binding net.tcp - wcfjqGrid TableToGrid remove row - jqueryhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1778694/using-loop-invariants-to-prove-the-correctness-of-heap-sort&usg=ALkJrhhdTMeasCl32e315z7g6LGavGCutwWhy doesn't it work, as I expect here? - bashAll Articles