Hi,
Another little random thing to get out of my sandbox. I just didn't like
the redundant information that it required.
Keith
ChangeLog
2006-03-15 Keith Seitz <[EMAIL PROTECTED]>
* gnu/classpath/jdwp/util/LineTable.java (lines): Remove all occurances
of this redundant variable.
(LineTable): Assert that the number of line numbers and the number of
code indicies is the same.
Index: LineTable.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/util/LineTable.java,v
retrieving revision 1.2
diff -u -r1.2 LineTable.java
--- LineTable.java 24 Aug 2005 22:57:07 -0000 1.2
+++ LineTable.java 16 Mar 2006 01:17:54 -0000
@@ -1,5 +1,5 @@
/* LineTable.java -- A class representing a Line Table for a method
- Copyright (C) 2005 Free Software Foundation
+ Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -54,25 +54,24 @@
private final long end;
private final int[] lineNum;
private final long[] lineCI;
- private final int lines;
/**
* Construct a line table with the given parameters.
*
* @param start lowest code index for method, -1 if native
* @param end highest code index for method, -1 if native
- * @param lines number of entries in line table
- * @param lineCI code indexes for entries in line tables (of length lines)
- * @param lineNum line numbers for in line tables (of length lines)
+ * @param lineNum line numbers for in line tables
+ * @param lineCI code indicies for entries in line tables
*/
- public LineTable(long start, long end, int lines, long lineCI[],
- int lineNum[])
+ public LineTable(long start, long end, int[] lineNum, long[] lineCI)
{
+ if (lineNum.length != lineCI.length)
+ throw new AssertionError("code index and line numbers tables "
+ + "not same length");
this.start = start;
this.end = end;
- this.lines = lines;
- this.lineCI = lineCI;
this.lineNum = lineNum;
+ this.lineCI = lineCI;
}
/**
@@ -86,8 +85,8 @@
{
os.writeLong(start);
os.writeLong(end);
- os.writeInt(lines);
- for (int i = 0; i < lines; i++)
+ os.writeInt(lineNum.length);
+ for (int i = 0; i < lineNum.length; i++)
{
os.writeLong(lineCI[i]);
os.writeInt(lineNum[i]);