1Object o = n u l l ;
2/∗@ assume o != n u l l ; @∗/
3Obj ec t [ ] a = new S t r i n g [ −5];
4a [ −3] = new I n t e g e r ( 2 ) ;
> escjava2 -q AssumeFalseTest.java
0 warnings
Exemple 11 (Non correction)
1i n t a [ ] = new i n t [ 6 ] ;
2f o r ( i n t i = 0; i <= 6 ; i ++) {
3a [ i ] = i ;
4}
> escjava2 -q Test.java
0 warnings
> escjava2 -Loop 7 -q Test.java
Test.java:15: Warning: Array index possibly too large (IndexTooBig)
a[i] = i;
^
1 warning
Exemple 12 (Incomplétude)
1/∗@ r e q u i r e s i == 5 && j== 3 ;
2@ e ns u r e s \ r e s u l t == 1 5;
3@∗/
4i n t m( i n t i , i n t j ) {
5re t u r n i ∗j ;
6}
Test.java:19: Warning: Postcondition possibly not established (Post)
}
^
Associated declaration is "Test.java", line 14, col 8:
@ ensures \result == 15;
1i n t m( i n t i , i n t j ) {
2/∗@ assume 15 == 5 ∗3 ; @∗/
3re t u r n i ∗j ;
4}
5