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.IConstantPoolConstant; 16 import org.eclipse.jdt.core.util.IConstantPoolEntry; 17 import org.eclipse.jdt.core.util.ILocalVariableTableEntry; 18 19 22 public class LocalVariableTableEntry extends ClassFileStruct implements ILocalVariableTableEntry { 23 24 private int startPC; 25 private int length; 26 private int nameIndex; 27 private int descriptorIndex; 28 private char[] name; 29 private char[] descriptor; 30 private int index; 31 32 40 public LocalVariableTableEntry( 41 byte[] classFileBytes, 42 IConstantPool constantPool, 43 int offset) throws ClassFormatException { 44 this.startPC = u2At(classFileBytes, 0, offset); 45 this.length = u2At(classFileBytes, 2, offset); 46 this.nameIndex = u2At(classFileBytes, 4, offset); 47 this.descriptorIndex = u2At(classFileBytes, 6, offset); 48 this.index = u2At(classFileBytes, 8, offset); 49 IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.nameIndex); 50 if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) { 51 throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY); 52 } 53 this.name = constantPoolEntry.getUtf8Value(); 54 constantPoolEntry = constantPool.decodeEntry(this.descriptorIndex); 55 if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) { 56 throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY); 57 } 58 this.descriptor = constantPoolEntry.getUtf8Value(); 59 } 60 61 64 public int getStartPC() { 65 return this.startPC; 66 } 67 68 71 public int getLength() { 72 return this.length; 73 } 74 75 78 public int getNameIndex() { 79 return this.nameIndex; 80 } 81 82 85 public int getDescriptorIndex() { 86 return this.descriptorIndex; 87 } 88 89 92 public int getIndex() { 93 return this.index; 94 } 95 96 99 public char[] getName() { 100 return this.name; 101 } 102 103 106 public char[] getDescriptor() { 107 return this.descriptor; 108 } 109 110 } 111 | Popular Tags |