Java Pathfinder (JPF) is a system to verify executable
Java bytecode
In computing, Java bytecode is the bytecode-structured instruction set of the Java virtual machine (JVM), a virtual machine that enables a computer to run programs written in the Java programming language and several other programming languages, ...
programs. JPF was developed at the
NASA
The National Aeronautics and Space Administration (NASA ) is an independent agency of the US federal government responsible for the civil space program, aeronautics research, and space research.
NASA was established in 1958, succeedi ...
Ames Research Center
The Ames Research Center (ARC), also known as NASA Ames, is a major NASA research center at Moffett Federal Airfield in California's Silicon Valley. It was founded in 1939 as the second National Advisory Committee for Aeronautics (NACA) labora ...
and open sourced in 2005. The acronym JPF is not to be confused with the unrelated ''Java Plugin Framework'' project.
The core of JPF is a
Java Virtual Machine
A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describ ...
. JPF executes normal
Java bytecode
In computing, Java bytecode is the bytecode-structured instruction set of the Java virtual machine (JVM), a virtual machine that enables a computer to run programs written in the Java programming language and several other programming languages, ...
programs and can store, match and restore program states. Its primary application has been
Model checking
In computer science, model checking or property checking is a method for checking whether a finite-state model of a system meets a given specification (also known as correctness). This is typically associated with hardware or software system ...
of
concurrent programs, to find defects such as
data races and
deadlock
In concurrent computing, deadlock is any situation in which no member of some group of entities can proceed because each waits for another member, including itself, to take action, such as sending a message or, more commonly, releasing a lo ...
s. With its respective extensions, JPF can also be used for a variety of other purposes, including
* model checking of distributed applications
* model checking of user interfaces
* test case generation by means of symbolic execution
* low level program inspection
* program instrumentation and runtime monitoring
JPF has no fixed notion of state space branches and can handle both data and scheduling choices.
Example
The following system under test contains a simple race condition between two
threads
Thread may refer to:
Objects
* Thread (yarn), a kind of thin yarn used for sewing
** Thread (unit of measurement), a cotton yarn measure
* Screw thread, a helical ridge on a cylindrical fastener
Arts and entertainment
* ''Thread'' (film), 2016 ...
accessing the same variable
d
in statements (1) and (2), which can lead to a division by zero
exception if (1) is executed before (2)
public class Racer implements Runnable
Without any additional configuration, JPF would find and report the division by zero. If JPF is configured to verify absence of race conditions (regardless of their potential downstream effects), it will produce the following output, explaining the error and showing a counter example leading to the error
JavaPathfinder v6.0 - (C) RIACS/NASA Ames Research Center
system under test
application: Racer.java
...
error #1
gov.nasa.jpf.listener.PreciseRaceDetector
race for field [email protected]
main at Racer.main(Racer.java:16)
"int c = 420 / racer.d; " : getfield
Thread-0 at Racer.run(Racer.java:7)
"d = 0; " : putfield
trace #1
---- transition #0 thread: 0
...
---- transition #3 thread: 1
gov.nasa.jpf.jvm.choice.ThreadChoiceFromSet d="sleep",isCascaded:false, insn w/o sources Racer.java:22 : try catch (InterruptedException ix)
Racer.java:23 : }
Racer.java:7 : d = 0;
...
---- transition #5 thread: 0
gov.nasa.jpf.jvm.choice.ThreadChoiceFromSet d="sharedField",isCascaded:false, Racer.java:16 : int c = 420 / racer.d;
Extensibility
JPF is an open system that can be extended in a variety of ways. The main extension constructs are
* ''listeners'' - to implement complex properties (e.g. temporal properties)
* ''peer classes'' - to execute code at the host JVM level (instead of JPF), which is mostly used to implement native methods
* ''bytecode factories'' - to provide alternative execution semantics of bytecode instructions (e.g. to implement symbolic execution)
* ''choice generators'' - to implement state space branches such as scheduling choices or data value sets
* ''serializers'' - to implement program state abstractions
* ''publishers'' - to produce different output formats
* ''search policies'' - to use different program state space traversal algorithms
JPF includes a runtime module system to package such constructs into separate ''JPF extension projects''. A number of such projects are available from the main JPF server, including a symbolic execution mode, numeric analysis, race condition detection for relaxed memory models, user interface model checking and many more.
Limitations
* JPF cannot analyze
Java native methods. If the system under test calls such methods, these have to be provided within peer classes, or intercepted by listeners
* as a model checker, JPF is susceptible to
Combinatorial explosion
In mathematics, a combinatorial explosion is the rapid growth of the complexity of a problem due to how the combinatorics of the problem is affected by the input, constraints, and bounds of the problem. Combinatorial explosion is sometimes used to ...
, although it performs on-the-fly
Partial order reduction In computer science, partial order reduction is a technique for reducing the size of the state-space to be searched by a model checking or automated planning and scheduling algorithm. It exploits the commutativity of concurrently executed transiti ...
* the configuration system for JPF modules and runtime options can be complex
See also
MoonWalker- similar to Java PathFinder, but for .NET programs instead of Java programs
External links
References
*Willem Visser, Corina S. Păsăreanu, Sarfraz Khurshid
Test Input Generation with Java PathFinder.In: George S. Avrunin, Gregg Rothermel (Eds.): Proceedings of the ACM/SIGSOFT International Symposium on Software Testing and Analysis 2004. ACM Press, 2004. {{ISBN, 1-58113-820-2.
Free software testing tools
* Willem Visser, Klaus Havelund, Guillaume Brat, Seungjoon Park, Flavio Lerda, Model Checking Programs, Automated Software Engineering 10(2), 2003.
* Klaus Havelund, Willem Visser, Program Model Checking as a New Trend, STTT 4(1), 2002.
* Klaus Havelund, Thomas Pressburger, Model Checking Java Programs using Java PathFinder, STTT 2(4), 2000.