jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/LocalVariable.java
author chegar
Sun, 17 Aug 2014 15:51:56 +0100
changeset 25868 686eef1e7a79
parent 12457 jaxp/src/com/sun/org/apache/bcel/internal/classfile/LocalVariable.java@c348e06f0e82
child 44797 8b3b3b911b8a
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
package com.sun.org.apache.bcel.internal.classfile;
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
/* ====================================================================
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * The Apache Software License, Version 1.1
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * Copyright (c) 2001 The Apache Software Foundation.  All rights
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * reserved.
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * Redistribution and use in source and binary forms, with or without
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * modification, are permitted provided that the following conditions
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * are met:
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * 1. Redistributions of source code must retain the above copyright
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 *    notice, this list of conditions and the following disclaimer.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 * 2. Redistributions in binary form must reproduce the above copyright
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 *    notice, this list of conditions and the following disclaimer in
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 *    the documentation and/or other materials provided with the
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 *    distribution.
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
 * 3. The end-user documentation included with the redistribution,
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
 *    if any, must include the following acknowledgment:
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
 *       "This product includes software developed by the
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
 *        Apache Software Foundation (http://www.apache.org/)."
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 *    Alternately, this acknowledgment may appear in the software itself,
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 *    if and wherever such third-party acknowledgments normally appear.
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 * 4. The names "Apache" and "Apache Software Foundation" and
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 *    "Apache BCEL" must not be used to endorse or promote products
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 *    derived from this software without prior written permission. For
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 *    written permission, please contact apache@apache.org.
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * 5. Products derived from this software may not be called "Apache",
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 *    "Apache BCEL", nor may "Apache" appear in their name, without
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 *    prior written permission of the Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 * SUCH DAMAGE.
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * ====================================================================
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 * This software consists of voluntary contributions made by many
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 * individuals on behalf of the Apache Software Foundation.  For more
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 * information on the Apache Software Foundation, please see
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
 * <http://www.apache.org/>.
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
import  com.sun.org.apache.bcel.internal.Constants;
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
import  java.io.*;
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
 * This class represents a local variable within a method. It contains its
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
 * scope, name, signature and index on the method's frame.
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
 * @author  <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
 * @see     LocalVariableTable
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
public final class LocalVariable
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
  implements Constants, Cloneable, Node, Serializable
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
{
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
  private int start_pc;        // Range in which the variable is valid
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
  private int length;
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
  private int name_index;      // Index in constant pool of variable name
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
  private int signature_index; // Index of variable signature
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
  private int index;            /* Variable is `index'th local variable on
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
                                * this method's frame.
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
                                */
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
  private ConstantPool constant_pool;
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
   * Initialize from another object. Note that both objects use the same
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
   * references (shallow copy). Use copy() for a physical copy.
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
  public LocalVariable(LocalVariable c) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
    this(c.getStartPC(), c.getLength(), c.getNameIndex(),
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
         c.getSignatureIndex(), c.getIndex(), c.getConstantPool());
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
   * Construct object from file stream.
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
   * @param file Input stream
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
   * @throws IOException
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
  LocalVariable(DataInputStream file, ConstantPool constant_pool)
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
       throws IOException
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
    this(file.readUnsignedShort(), file.readUnsignedShort(),
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
         file.readUnsignedShort(), file.readUnsignedShort(),
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
         file.readUnsignedShort(), constant_pool);
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
   * @param start_pc Range in which the variable
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
   * @param length ... is valid
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
   * @param name_index Index in constant pool of variable name
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
   * @param signature_index Index of variable's signature
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
   * @param index Variable is `index'th local variable on the method's frame
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
   * @param constant_pool Array of constants
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
  public LocalVariable(int start_pc, int length, int name_index,
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
                       int signature_index, int index,
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
                       ConstantPool constant_pool)
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
    this.start_pc        = start_pc;
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
    this.length          = length;
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
    this.name_index      = name_index;
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
    this.signature_index = signature_index;
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
    this.index           = index;
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
    this.constant_pool   = constant_pool;
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
   * Called by objects that are traversing the nodes of the tree implicitely
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
   * defined by the contents of a Java class. I.e., the hierarchy of methods,
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
   * fields, attributes, etc. spawns a tree of objects.
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
   * @param v Visitor object
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
  public void accept(Visitor v) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
    v.visitLocalVariable(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
   * Dump local variable to file stream in binary format.
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
   *
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
   * @param file Output file stream
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
   * @throws IOException
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
  public final void dump(DataOutputStream file) throws IOException
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
  {
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
    file.writeShort(start_pc);
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
    file.writeShort(length);
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
    file.writeShort(name_index);
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
    file.writeShort(signature_index);
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
    file.writeShort(index);
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
   * @return Constant pool used by this object.
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
  public final ConstantPool getConstantPool() { return constant_pool; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
   * @return Variable is valid within getStartPC() .. getStartPC()+getLength()
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
  public final int getLength()         { return length; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
   * @return Variable name.
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
  public final String getName() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
    ConstantUtf8  c;
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
    c = (ConstantUtf8)constant_pool.getConstant(name_index, CONSTANT_Utf8);
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
    return c.getBytes();
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
   * @return Index in constant pool of variable name.
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
  public final int getNameIndex()      { return name_index; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
   * @return Signature.
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
  public final String getSignature() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
    ConstantUtf8  c;
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
    c = (ConstantUtf8)constant_pool.getConstant(signature_index,
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
                                                CONSTANT_Utf8);
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
    return c.getBytes();
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
   * @return Index in constant pool of variable signature.
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
  public final int getSignatureIndex() { return signature_index; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
   * @return index of register where variable is stored
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
  public final int getIndex()           { return index; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
   * @return Start of range where he variable is valid
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
  public final int getStartPC()        { return start_pc; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
   * @param constant_pool Constant pool to be used for this object.
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
  public final void setConstantPool(ConstantPool constant_pool) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
    this.constant_pool = constant_pool;
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
   * @param length.
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
  public final void setLength(int length) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
    this.length = length;
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
   * @param name_index.
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
  public final void setNameIndex(int name_index) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
    this.name_index = name_index;
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
   * @param signature_index.
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
  public final void setSignatureIndex(int signature_index) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
    this.signature_index = signature_index;
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
   * @param index.
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
  public final void setIndex(int index) { this.index = index; }
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
   * @param start_pc Specify range where the local variable is valid.
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
  public final void setStartPC(int start_pc) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
    this.start_pc = start_pc;
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
   * @return string representation.
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
  public final String toString() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
    String name = getName(), signature = Utility.signatureToString(getSignature());
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
    return "LocalVariable(start_pc = " + start_pc + ", length = " + length +
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
      ", index = " + index + ":" + signature + " " + name + ")";
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
   * @return deep copy of this object
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
  public LocalVariable copy() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
    try {
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
      return (LocalVariable)clone();
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
    } catch(CloneNotSupportedException e) {}
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
    return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
}