dbc_javac
Name
dbc_javac - javac with "Design by Contract" enabled.
Synopsis
dbc_javac [dbc_javac options] [javac options]
Description
The dbc_javac command is a "Design by Contract" enabled replacement for javac . dbc_javac should be used in place of the javac command whenever you want the code's contracts to be checked at runtime.
The dbc_javac command checks the DbC specification in the Javadoc comments, generates instrumented .java files with extra code to check the contracts in the Javadoc comments and compiles the instrumented .java files with the javac compiler.
This process produces .class files instrumented with extra bytecodes to check the contracts at runtime. Unless -Zruntime_handler NONE is specified, jcontract.zip must be accessible at runtime to the classes compiled with dbc_javac .
Options
The dbc_javac command accepts the same options as the javac command. In addition, it accesses some additional options of the form "-Z ...":
-Z@(pre|post|invariant|concurrency|throws|assert|verbose) (on|off)
Controls whether the specific contract type is instrumented.
Overrides the Instrumentation.InstrumentXXXCondition preference in the preferences file.
Example: -Z@pre off , if compiling with this option the resulting .class files will not check the @pre contracts.
-Zdefault_concurrency (concurrent|guarded|sequential)
Sets the default concurrency contract for methods without an explicit "@concurrency" contract.
Overrides the Instrumentation.DefaultConcurrency preference in the preferences file. Note that the default value in that file is concurrent, the default mode for Java methods.
-Zstatistics
Shows instrumentation statistics.
-Ztimings
Shows timing information.
-Zverbose
Shows the steps being taken. Also enables -Zstatistics and -Ztimings .
-Zlog (on|off)
Sets logging mode to on or off . Default is on .
Overrides the Instrumentation.WriteLog preference in the preferences file.
-Zlog_file (path|stdout|stderr)
Specifies the file to write the login info to.
Example: -Zlog_file stdout will write logging info to the command console.
Overrides the Instrumentation.LogFile preference in the preferences file.
The default value in that file is jcontract.log .
-Zpreferences_file path
Specifies the preferences file to use. If this option is not set, dbc_javac searches for a preferences file in the following locations (in the order listed):
- The location specified by the DBC_PREFERENCES environment variable.
- The "jcontract.preferences" file in your home directory.
- The "jcontract.preferences" files in the Jcontract installation directory.
The first preference file found will be used.
-Zruntime_handler (class_name|NONE)
Specifies the Runtime Handler that will be associated with the compiled classes. Overrides the Instrumentation.RuntimeHandler preference in the preferences file. The default value in that file is jcontract.MonitorRuntimeHandler . For more information about Runtime Handlers see Runtime Handlers.
If the NONE option is chosen, then no runtime handler will be used. In this case, you may use dbc_javac to instrument the code and the contracts will be enforced at runtime by throwing a RuntimeException whenever a contract is violated. This technique is useful for distributing code built with Design by Contract comment enforcement to those that do not have Jcontract.
Example: Classes compiled with the -Zruntime_handle UserDefinedRuntimeHandler option will use an instance of the class UserDefinedRuntimeHandler as Runtime Handler
-Zjava_compiler {compiler_command}
Uses {compiler_command} to compile the original and instrumented classes.
Example 1: -Zjava_compiler jikes . Example 2: -Zjava_compiler c:\jdk1.2.2\bin\javac
The default value for this flag is javac . Note that only javac is fully supported. If you have problems using another compiler, contact jcontract@parasoft.com.
See Also
dbc_preferences
Jcontract Preferences
Jcontract's Monitors
Runtime Handlers.
|