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.ILocalVariableAttribute; 16 import org.eclipse.jdt.core.util.ILocalVariableTableEntry; 17 18 21 public class LocalVariableAttribute 22 extends ClassFileAttribute 23 implements ILocalVariableAttribute { 24 25 private static final ILocalVariableTableEntry[] NO_ENTRIES = new ILocalVariableTableEntry[0]; 26 private int localVariableTableLength; 27 private ILocalVariableTableEntry[] localVariableTable; 28 29 36 public LocalVariableAttribute( 37 byte[] classFileBytes, 38 IConstantPool constantPool, 39 int offset) 40 throws ClassFormatException { 41 super(classFileBytes, constantPool, offset); 42 final int length = u2At(classFileBytes, 6, offset); 43 this.localVariableTableLength = length; 44 if (length != 0) { 45 int readOffset = 8; 46 this.localVariableTable = new ILocalVariableTableEntry[length]; 47 for (int i = 0; i < length; i++) { 48 this.localVariableTable[i] = new LocalVariableTableEntry(classFileBytes, constantPool, offset + readOffset); 49 readOffset += 10; 50 } 51 } else { 52 this.localVariableTable = NO_ENTRIES; 53 } 54 } 55 58 public ILocalVariableTableEntry[] getLocalVariableTable() { 59 return this.localVariableTable; 60 } 61 62 65 public int getLocalVariableTableLength() { 66 return this.localVariableTableLength; 67 } 68 69 } 70 | Popular Tags |