next up previous contents
Next: 3. Code Instrumentation Up: Diploma Thesis: Utility Support Previous: 1. Introduction   Contents

Subsections


2. Related Work

This chapter lists both papers and software related to this diploma thesis. For some of the work there is a detailed comparison in subsequent chapters.


2.1 Runtime Constraint Checking

This section lists tools, which perform runtime constraint checking on java programs, more or less similar to the tool developed in chapter [*].

JMSAssert ([MMS]) provides OCL support for java. Constraints are embedded into javadoc comments. The tool links into the JVM to make the constraints checked. This approach does not involve source code modification. This makes it easier to use, but also platform dependent (currently Windows only). It also requires just-in-time compilers to be switched off. Binaries are available at no cost.

Several approaches instrument java byte code to make constraints checked, such as Handshake ([DH98]) and jContractor ([KHB98]). Section [*] discusses, whether the approach of source code instrumentation presented in this paper is adaptable to byte code instrumentation. Handshake uses separate text files with a non-standard syntax to express class invariants and pre/postconditions. jContractor implements constraints with dedicated java methods. Neither Handshake nor jContractor binaries are publicly available.

iContract ([RK98]) is a preprocessor for java. It instruments java source code to check constraints. It supports a subset of OCL. Constraints are embedded into javadoc comments. iContracts source code instrumentation is analyzed in detail in section [*]. Binaries are available at no cost.

For some applications OCL is just too powerful. A simpler approach is demonstrated in [KSR00]. It implements a number of predefined constraint types, such as numeric range or ordering of arrays. For instance to have an attribute age constrained to positive values, one just adds a method getAgeMinValue() {return 0;}. Most OCL constraints used in the development of the OCL toolkit also could have been expressed with such simple means. Constrained classes must be valid JavaBeans. Also, the class must announce the modification of attributes manually to have the constraints reevaluated. KBeans is released under GPL. Additionally there is a GUI for simulating an object population and checking constraints against it.

Jass ([JASS]) is a preprocessor for java assertions developed at the University of Oldenburg ([DB99]). Apart from class invariants and method pre- and postconditions it provides check statements (like assert() in C++) and loop invariants and variants. Assertions are expressed in java, extended by universal and existential quantifiers. Section [*] analyses the code instrumentation of Jass in detail. Jass is available under GPL.

The following table summarizes the tools introduced above. The last line shows the tool developed with this paper.



  Constraint Source Verification Method Availability
JMSAssert OCL in javadoc links JVM binary
    (platform dependent)  
Handshake proprietary language byte code instr. / not
    proxy system library available
jContractor java methods byte code instr. / not
    class loader available
iContract OCL in javadoc source code instr. binary
KBeans predefined constraint in special environment GPL
  types / java methods    
Jass java fragments in javadoc source code instr. GPL
Dresden OCL in javadoc source code instr. LGPL
Toolkit   (reversible)  



2.2 Reverse Engineering

This section lists work related to reverse engineering needed in chapter [*].

A powerful approach to reverse engineering has been developed at the MIT [JW99]. The tool Superwomble extracts an object model from java byte code. Object models are roughly a subset of UML class diagrams, featuring inheritance and object associations. An important challenge for the analysis is the detection of element types of container attributes. The tool performs this very efficiently, without requiring any additional help from the user. Thus, it complements the two approaches presented in this paper. A detailed comparison is provided in section [*].

JVision [OI] produces class diagrams from java source or byte code. It's easy to use and has nice auto-layout. But it does not handle associations in any way. Collection attributes are simply shown as attributes. Instead it analyses, which classes instantiate/use each other. This is not nearly as useful as associations.

2.3 Other Related Work

Cybernetic Intelligence develops an OCL compiler ([CI]). The current prototype claims to support syntax checking only. Type checking is under development. Frontends are available for Select Enterprise and Rational Rose.

Elixir ([ET]) claims OCL support in it's CASE tool and its java IDE. The CASE tool provides an OCL text field only, without any syntax checking. For the IDE a plugin is provided to integrate iContract.

Several approaches implement OCL upon object repositories, such as USE [RG00] and ModelRun [BS]. The object repositories can be populated and animated visually, with OCL constraints continuesly being checked.

There is a universal code instrumentation toolkit ([CMA]) available for java. It parses java files into parse trees, preserving white space and comments. The parse tree can be modified and written back into the file. There are various applications for this, including tracing/profiling of program execution. The code instrumentation developed in this paper could probably be realized using this toolkit. However, the parser analyses the complete java file, thus is much more heavy-weight than the parser developed with this paper. There is a test version available at no cost, limited in the size of source programs it can handle.


next up previous contents
Next: 3. Code Instrumentation Up: Diploma Thesis: Utility Support Previous: 1. Introduction   Contents
Ralf Wiebicke 2005-11-25