jaxp/src/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java
author dbuck
Thu, 10 Jan 2013 20:26:00 -0800
changeset 15346 3f6fd93fec9a
parent 12457 c348e06f0e82
permissions -rw-r--r--
8003147: port fix for BCEL bug 39695 Summary: Added support for Local Variable Type Table so that BCEL library can be used to modify methods with generics-related debug data without violating class file format Reviewed-by: lancea
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
import java.util.Stack;
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
 * Traverses a JavaClass with another Visitor object 'piggy-backed'
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
 * that is applied to all components of a JavaClass object. I.e. this
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
 * class supplies the traversal strategy, other classes can make use
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
 * of it.
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
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
public class DescendingVisitor implements Visitor {
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
  private JavaClass clazz;
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
  private Visitor   visitor;
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
  private Stack     stack = new Stack();
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
  /** @return container of current entitity, i.e., predecessor during traversal
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
  public Object predecessor() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
    return predecessor(0);
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
   * @param level nesting level, i.e., 0 returns the direct predecessor
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
   * @return container of current entitity, i.e., predecessor during traversal
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
  public Object predecessor(int level) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
    int size = stack.size();
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    if((size < 2) || (level < 0))
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
      return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
    else
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
      return stack.elementAt(size - (level + 2)); // size - 1 == current
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
  /** @return current object
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
  public Object current() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
    return stack.peek();
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
   * @param clazz Class to traverse
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
   * @param visitor visitor object to apply to all components
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
  public DescendingVisitor(JavaClass clazz, Visitor visitor) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
    this.clazz   = clazz;
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    this.visitor = visitor;
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
  /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
   * Start traversal.
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
   */
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
  public void visit() { clazz.accept(this); }
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
  public void visitJavaClass(JavaClass clazz) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
    stack.push(clazz);
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
    clazz.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
    Field[] fields = clazz.getFields();
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
    for(int i=0; i < fields.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
      fields[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
    Method[] methods = clazz.getMethods();
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
    for(int i=0; i < methods.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
      methods[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
    Attribute[] attributes = clazz.getAttributes();
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
    for(int i=0; i < attributes.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
      attributes[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
    clazz.getConstantPool().accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
  public void visitField(Field field) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
    stack.push(field);
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
    field.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
    Attribute[] attributes = field.getAttributes();
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
    for(int i=0; i < attributes.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
      attributes[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
  public void visitConstantValue(ConstantValue cv) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
    stack.push(cv);
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
    cv.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
  public void visitMethod(Method method) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
    stack.push(method);
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
    method.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
    Attribute[] attributes = method.getAttributes();
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
    for(int i=0; i < attributes.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
      attributes[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
  public void visitExceptionTable(ExceptionTable table) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
    stack.push(table);
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
    table.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
  public void visitCode(Code code) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
    stack.push(code);
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
    code.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
    CodeException[] table = code.getExceptionTable();
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
    for(int i=0; i < table.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
      table[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
    Attribute[] attributes = code.getAttributes();
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
    for(int i=0; i < attributes.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
      attributes[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
  public void visitCodeException(CodeException ce) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
    stack.push(ce);
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
    ce.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
  public void visitLineNumberTable(LineNumberTable table) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
    stack.push(table);
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
    table.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
    LineNumber[] numbers = table.getLineNumberTable();
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
    for(int i=0; i < numbers.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
      numbers[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
  public void visitLineNumber(LineNumber number) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
    stack.push(number);
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
    number.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
  public void visitLocalVariableTable(LocalVariableTable table) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
    stack.push(table);
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
    table.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
    LocalVariable[] vars = table.getLocalVariableTable();
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
    for(int i=0; i < vars.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
      vars[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
15346
3f6fd93fec9a 8003147: port fix for BCEL bug 39695
dbuck
parents: 12457
diff changeset
   213
  public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) {
3f6fd93fec9a 8003147: port fix for BCEL bug 39695
dbuck
parents: 12457
diff changeset
   214
    stack.push(obj);
3f6fd93fec9a 8003147: port fix for BCEL bug 39695
dbuck
parents: 12457
diff changeset
   215
    obj.accept(visitor);
3f6fd93fec9a 8003147: port fix for BCEL bug 39695
dbuck
parents: 12457
diff changeset
   216
    stack.pop();
3f6fd93fec9a 8003147: port fix for BCEL bug 39695
dbuck
parents: 12457
diff changeset
   217
  }
3f6fd93fec9a 8003147: port fix for BCEL bug 39695
dbuck
parents: 12457
diff changeset
   218
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
  public void visitStackMap(StackMap table) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
    stack.push(table);
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
    table.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
    StackMapEntry[] vars = table.getStackMap();
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
    for(int i=0; i < vars.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
      vars[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
  public void visitStackMapEntry(StackMapEntry var) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
    stack.push(var);
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
    var.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
  public void visitLocalVariable(LocalVariable var) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
    stack.push(var);
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
    var.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
  public void visitConstantPool(ConstantPool cp) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
    stack.push(cp);
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
    cp.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
    Constant[] constants = cp.getConstantPool();
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
    for(int i=1; i < constants.length; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
      if(constants[i] != null)
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
        constants[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
  public void visitConstantClass(ConstantClass constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
  public void visitConstantDouble(ConstantDouble constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
  public void visitConstantFieldref(ConstantFieldref constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
  public void visitConstantFloat(ConstantFloat constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
 }
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
  public void visitConstantInteger(ConstantInteger constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
  public void visitConstantInterfaceMethodref(ConstantInterfaceMethodref constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
  public void visitConstantLong(ConstantLong constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
7f561c08de6b Initial load
duke
parents:
diff changeset
   297
  public void visitConstantMethodref(ConstantMethodref constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   298
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   299
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   300
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   301
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   302
7f561c08de6b Initial load
duke
parents:
diff changeset
   303
  public void visitConstantNameAndType(ConstantNameAndType constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   304
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   305
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   306
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   307
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   308
7f561c08de6b Initial load
duke
parents:
diff changeset
   309
  public void visitConstantString(ConstantString constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   312
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   313
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
  public void visitConstantUtf8(ConstantUtf8 constant) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
    stack.push(constant);
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
    constant.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
  public void visitInnerClasses(InnerClasses ic) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
    stack.push(ic);
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
    ic.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
    InnerClass[] ics = ic.getInnerClasses();
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
    for(int i=0; i < ics.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
   327
      ics[i].accept(this);
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   330
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
  public void visitInnerClass(InnerClass inner) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
    stack.push(inner);
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
    inner.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
  public void visitDeprecated(Deprecated attribute) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
    stack.push(attribute);
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
    attribute.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   340
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   341
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   342
7f561c08de6b Initial load
duke
parents:
diff changeset
   343
  public void visitSignature(Signature attribute) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   344
    stack.push(attribute);
7f561c08de6b Initial load
duke
parents:
diff changeset
   345
    attribute.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   346
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   347
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   348
7f561c08de6b Initial load
duke
parents:
diff changeset
   349
  public void visitSourceFile(SourceFile attribute) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   350
    stack.push(attribute);
7f561c08de6b Initial load
duke
parents:
diff changeset
   351
    attribute.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   352
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   353
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   354
7f561c08de6b Initial load
duke
parents:
diff changeset
   355
  public void visitSynthetic(Synthetic attribute) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   356
    stack.push(attribute);
7f561c08de6b Initial load
duke
parents:
diff changeset
   357
    attribute.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   358
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   359
  }
7f561c08de6b Initial load
duke
parents:
diff changeset
   360
7f561c08de6b Initial load
duke
parents:
diff changeset
   361
  public void visitUnknown(Unknown attribute) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   362
    stack.push(attribute);
7f561c08de6b Initial load
duke
parents:
diff changeset
   363
    attribute.accept(visitor);
7f561c08de6b Initial load
duke
parents:
diff changeset
   364
    stack.pop();
7f561c08de6b Initial load
duke
parents:
diff changeset
   365
 }
7f561c08de6b Initial load
duke
parents:
diff changeset
   366
}