JML-ESC-1 - 272: Software Engineering Fall 2008 Instructor:...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
272: Software Engineering Fall 2008 Instructor: Tevfik Bultan Lecture 3: Java Modeling Language and Extended Static Checking
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Modeling Language (JML) JML is a behavioral interface specification language The Application Programming Interface (API) in a typical programming language (for example consider the API of a set of Java classes) provides very little information The method names and return types, argument names and types This type of API information is not sufficient for figuring out what a component does JML is a specification language that allows specification of the behavior of an API not just its syntax, but its semantics JML specifications are written as annotations As far as Java compiler is concerned they are comments but a JML compiler can interpret them
Background image of page 2
JML Project(s) and Materials Information about JML and JML based projects are available at Gary Leavens’ website: http://www.cs.ucf.edu/~leavens/JML/ My lecture notes are based on: Lilian Burdy, Yoonsik Cheon, David Cok, Michael Ernst, Joe Kiniry, Gary T. Leavens, K. Rustan M. Leino, and Erik Poll. An overview of JML tools and applications. International Journal on Software Tools for Technology Transfer , 7(3):212-232, June 2005 – Slides by Yoonsik Cheon JML tutorials by Joe Kiniry
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
JML One goal of JML is to make it easily understandable and usable by Java programmers, so it stays close to the Java syntax and semantics whenever possible JML supports design by contract style specifications with Pre-conditions Post-conditions Class invariants JML supports quantification ( \forall , \exists ), and specification- only fields and methods Due to these features JML specifications are more expressive than Eiffel contracts and can be made more precise and complete compared to Eiffel contracts
Background image of page 4
JMLAnnotations JML assertions are added as comments to the Java source code either between /*@ . . . @*/ or after //@ These are annotations and they are ignored by the Java compiler In JML properties are specified as Java boolean expressions JML provides operators to support design by contract style specifications such as \old and \result JML also provides quantification operators ( \forall , \exists ) JML also has additional keywords such as requires, ensures, signals, assignable, pure, invariant, non null, . . .
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Design by Contract in JML In JML constracts: Preconditions are written as a requires clauses Postconditions are written as ensures clauses Invariants are written as invariant clauses
Background image of page 6
JML assertions JML assertions are written as Java expressions, but: Cannot have side effects No use of = , ++ , -- , etc., and Can only call pure methods (i.e., methods with no side effects) JML extentions to Java expression syntax: Syntax Meaning \result the return value for the method call \old(E) value of E just before the method call a ==> b a implies b a <== b b implies a a <==> b a if and only if b a <=!=> b !(a <==> b)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 81

JML-ESC-1 - 272: Software Engineering Fall 2008 Instructor:...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online