A method for modifying a class file to monitor data flow is provided. The
method includes selecting (401) one or more methods in the class file and
adding (206, 209) one or more lines of code to report incoming arguments
and return values, if any, in the selected method. The incoming arguments
and return values are reported (405, 410) to an instrumentation interface
which may be an instrumentation class defining methods for each type of
argument in the method. The one or more lines of code pass the incoming
arguments and return values to the appropriate instrumentation class
method. The method may produce a profile of data flow including a record
of incoming arguments and return values, if any, for one or more methods
in a class file. The record can include data describing the types and
values of arguments and return values and their distribution.