diff options
Diffstat (limited to 'src/main/javassist/bytecode/LocalVariableAttribute.java')
-rw-r--r-- | src/main/javassist/bytecode/LocalVariableAttribute.java | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/src/main/javassist/bytecode/LocalVariableAttribute.java b/src/main/javassist/bytecode/LocalVariableAttribute.java index 735d609f..a88dfac7 100644 --- a/src/main/javassist/bytecode/LocalVariableAttribute.java +++ b/src/main/javassist/bytecode/LocalVariableAttribute.java @@ -20,7 +20,8 @@ import java.io.IOException; import java.util.Map; /** - * <code>LocalVariableTable_attribute</code>. + * <code>LocalVariableTable_attribute</code> or + * <code>LocalVariableTypeTable_attribute</code>. */ public class LocalVariableAttribute extends AttributeInfo { /** @@ -28,6 +29,11 @@ public class LocalVariableAttribute extends AttributeInfo { */ public static final String tag = "LocalVariableTable"; + /** + * The name of the attribute <code>"LocalVariableTypeTable"</code>. + */ + public static final String typeTag = "LocalVariableTypeTable"; + LocalVariableAttribute(ConstPool cp, int n, DataInputStream in) throws IOException { @@ -85,7 +91,7 @@ public class LocalVariableAttribute extends AttributeInfo { } /** - * Returns <code>local_variable_table[i].name_index</code>. + * Returns the value of <code>local_variable_table[i].name_index</code>. * This represents the name of the local variable. * * @param i the i-th entry. @@ -105,8 +111,14 @@ public class LocalVariableAttribute extends AttributeInfo { } /** - * Returns <code>local_variable_table[i].descriptor_index</code>. + * Returns the value of + * <code>local_variable_table[i].descriptor_index</code>. * This represents the type descriptor of the local variable. + * <p> + * If this attribute represents a LocalVariableTypeTable attribute, + * this method returns the value of + * <code>local_variable_type_table[i].signature_index</code>. + * It represents the type of the local variable. * * @param i the i-th entry. */ @@ -115,9 +127,26 @@ public class LocalVariableAttribute extends AttributeInfo { } /** + * This method is equivalent to <code>descriptorIndex()</code>. + * If this attribute represents a LocalVariableTypeTable attribute, + * this method should be used instead of <code>descriptorIndex()</code> + * since the method name is more appropriate. + * + * @param i the i-th entry. + * @see #descriptorIndex(int) + */ + public int signatureIndex(int i) { + return descriptorIndex(i); + } + + /** * Returns the type descriptor of the local variable * specified by <code>local_variable_table[i].descriptor_index</code>. - * + * <p> + * If this attribute represents a LocalVariableTypeTable attribute, + * this method returns the type signature of the local variable + * specified by <code>local_variable_type_table[i].signature_index</code>. + * * @param i the i-th entry. */ public String descriptor(int i) { @@ -125,6 +154,19 @@ public class LocalVariableAttribute extends AttributeInfo { } /** + * This method is equivalent to <code>descriptor()</code>. + * If this attribute represents a LocalVariableTypeTable attribute, + * this method should be used instead of <code>descriptor()</code> + * since the method name is more appropriate. + * + * @param i the i-th entry. + * @see #descriptor(int) + */ + public String signature(int i) { + return descriptor(i); + } + + /** * Returns <code>local_variable_table[i].index</code>. * This represents the index of the local variable. * |