The methodLineTables data string format

The methodLineTables data string encodes a table with one entry for every executable unit in a class.

The value of each entry in the methodLineTables table is the line number (in the source file named by the classSourceFile data string) for the corresponding executable unit. For example, entry number five in the table gives the line number for executable unit number five.

Here is an example of a methodLineTables string:
#51+1201#75+11,41
Here is how to interpret the string:
  • The digits immediately following a number sign ("#") represent a complete line number in the source code for a class. In the example, the first executable unit in the first method in the class is on line 51.
  • Each single digit following a plus sign ("+") represents the number of lines to add to the previous line number to produce the line number for the next executable unit. In the example, the digits following the plus sign (+1201) are used to calculate the line numbers for the second through the fifth executable unit:
    1. 51 + 1 = the second executable unit line number: 52
    2. 52 + 2 = the third executable unit line number: 54
    3. 54 + 0 = the fourth executable unit line number: 54 (two executable units on one source line)
    4. 54 + 1 = the fifth executable unit line number: 55
  • When a line number increment is negative or greater than nine, the complete line number for the executable unit is specified. In the example, the sixth executable unit is on line 75, twenty greater than the previous line number, which was 55. In this case, the complete line number is specified for the sixth executable unit, and the relative line number calculation begins again (#75+11):
    1. 75 = the sixth executable unit line number
    2. 75 + 1 = the seventh executable unit line number: 76
    3. 76 + 1 = the eighth executable unit line number: 77
  • A comma (",") denotes the end of one method and the beginning of the next. The digits and symbols following the comma are interpreted as before. In the example, the line number of the second method's first executable unit is only 4 greater than the last line number calculated for the previous method, so the relative line number calculation continues after the comma (,41):
    1. 77 + 4 = the second method's first executable unit line number: 81
    2. 81 + 1 = the second method's second executable unit line number: 82
Note: Not all executable units have source information associated with them. Some are created by the compiler to implement semantics of the Java language: exception handling, initialization, or synchronization, for example. These generated executable units have a complete line number of zero in the methodLineTables string. A complete line number of zero indicates that no line number information is available. When an entire method has no source information, it appears to have a single executable unit corresponding to line number zero.
Here are some more examples of methodLineTables strings and their meanings:
methodLineTables String Meaning
+5 If the line number of the first executable unit of the first method is less than ten, the entire string starts with a plus sign to begin an increment series from line zero. In this example, the first method's first executable unit starts on line 5.
+0 If the first method has no source information, the string starts with +0. Any executableUnit probe fragment that applies to such a method is inserted only once, at the beginning of the method.
...#437,#457+123... If the first executable unit for a method starts more than nine lines after the last executable unit for the previous method, the pattern is a comma, a number sign, and the line number string for the first executable unit in the new method. In this partial example, the first executable unit in the new method starts 20 lines after the previous method's last executable unit.
...#437,+2... It is possible for the last executable unit in a method to require the "#" notation, and the first executable unit in the next method be a small distance away. In this partial example, the last executable unit of one method starts on line 437, and the first executable unit of the next method starts on line 439.
Related reference
Probe fragments