Verificare şi Validarea Sistemelor Soft Tem ă Laborator 1 Tools for JML jmlc & jmlrac Dat ă primire laborator: Lab 1 Dat ă predare laborator: Lab 2
Verificare şi Validarea Sistemelor Soft Extended static checking with ESC/Java Automatically tries to prove simple JML assertions at compile time. checks specs at compile-time proves correctness of specs. Warn about likely runtime exceptions and violations. Runtime assertion checking with jmlc/jmlrac Special compiler inserts runtime tests for all JML assertions. Any assertion violation results in a special exception. checks specs at run-time. only tests correctness of specs. Find violations at runtime. Tools for JML
Verificare şi Validarea Sistemelor Soft Runtime assertion checking Normally Compile using javac to get A.class Execute A.class using javac To do JML runtime assertion checking – Compile using jmlc to get A.class (compiles an instrumented version of the code where JML-assertions are explicitly checked) – Execute A.class using jmlrac (translates JML assertions into runtime checks:during execution, all assertions are tested and any violation of an assertion produces an Error) Actually, jmlc is a preprocessor for javac, and jmlrac a wrapper for java. Typically, you use jmlc/jmlrac when testing code. Benefit (we hope) : More errors detected, with less effort.
Verificare şi Validarea Sistemelor Soft normal_behavior keyword notes that method should finish normally. behavior keyword notes that there can be an exception thrown. exceptional_behavior states that the method must always terminate with an exception. signals clause can be used to describe under what condition an exception can be thrown. Method specification Specifying Exceptions
jmlc and jmlrac - Demo 01: Factorial Exception – Demo02: Integer sqrt jmlc and jmlrac – by example
Verificare şi Validarea Sistemelor Soft Temă Laborator 1 Tools for JML jmlc & jmlrac Dată primire laborator: Lab 1 Dată predare laborator: Lab 2 A se vedea fişierul TemaLab01_JML.pdf