1 11 package org.eclipse.jdt.internal.core.util; 12 13 import org.eclipse.jdt.core.util.ClassFormatException; 14 import org.eclipse.jdt.core.util.IConstantPool; 15 import org.eclipse.jdt.core.util.ILineNumberAttribute; 16 17 20 public class LineNumberAttribute 21 extends ClassFileAttribute 22 implements ILineNumberAttribute { 23 24 private static final int[][] NO_ENTRIES = new int[0][0]; 25 private int lineNumberTableLength; 26 private int[][] lineNumberTable; 27 28 35 public LineNumberAttribute( 36 byte[] classFileBytes, 37 IConstantPool constantPool, 38 int offset) 39 throws ClassFormatException { 40 super(classFileBytes, constantPool, offset); 41 42 final int length = u2At(classFileBytes, 6, offset); 43 this.lineNumberTableLength = length; 44 if (length != 0) { 45 this.lineNumberTable = new int[length][2]; 46 int readOffset = 8; 47 for (int i = 0; i < length; i++) { 48 this.lineNumberTable[i][0] = u2At(classFileBytes, readOffset, offset); 49 this.lineNumberTable[i][1] = u2At(classFileBytes, readOffset + 2, offset); 50 readOffset += 4; 51 } 52 } else { 53 this.lineNumberTable = NO_ENTRIES; 54 } 55 } 56 59 public int[][] getLineNumberTable() { 60 return this.lineNumberTable; 61 } 62 63 66 public int getLineNumberTableLength() { 67 return this.lineNumberTableLength; 68 } 69 70 } 71 | Popular Tags |