jdk/test/java/lang/instrument/ilib/ClassReaderWriter.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
package ilib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
class ClassReaderWriter implements RuntimeConstants {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
    int codeAttributeIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
    int lineNumberAttributeIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
    int localVarAttributeIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
    private final byte[] orig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
    private final byte[] gen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
    private final int sectionLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    private static final int GROWTH_FACTOR = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    private static final int SECTIONS = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    private static final String codeAttributeName = "Code";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    private static final String lineNumberAttributeName = "LineNumberTable";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    private static final String localVarAttributeName = "LocalVariableTable";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private int[] genSectionPos = new int[SECTIONS];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    private int inputPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private int genPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    private int markPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private int currentSection = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    private String[] constantPool;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    ClassReaderWriter(byte[] orig) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        this.orig = orig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        sectionLength = orig.length * GROWTH_FACTOR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        gen = new byte[sectionLength * SECTIONS];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        for (int section = 0; section < SECTIONS; ++section) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
            genSectionPos[section] = section * sectionLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    int setSection(int section) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        int prevSection = currentSection;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        genSectionPos[prevSection] = genPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        genPos = genSectionPos[section];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        currentSection = section;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        return prevSection;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    byte[] result() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        int section;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        int totalLength = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        setSection(0); // save current section
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        for (section = 0; section < SECTIONS; ++section) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            int sectionStart = section * sectionLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            int sectionGenLength = genSectionPos[section] - sectionStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
            totalLength += sectionGenLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        byte[] newcf = new byte[totalLength];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        int written = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        for (section = 0; section < SECTIONS; ++section) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            int sectionStart = section * sectionLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            int sectionGenLength = genSectionPos[section] - sectionStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            System.arraycopy(gen, sectionStart, newcf, written, sectionGenLength);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            written += sectionGenLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        return newcf;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    int readU1() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        return ((int)orig[inputPos++]) & 0xFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    int readU2() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        int res = readU1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        return (res << 8) + readU1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    short readS2() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        int res = readU1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        return (short)((res << 8) + readU1());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    int readU4() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        int res = readU2();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        return (res << 16) + readU2();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    void writeU1(int val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        gen[genPos++] = (byte)val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    void writeU2(int val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        writeU1(val >> 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        writeU1(val & 0xFF);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    void writeU4(int val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        writeU2(val >> 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        writeU2(val & 0xFFFF);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    int copyU1() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        int value = readU1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        writeU1(value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    int copyU2() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        int value = readU2();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        writeU2(value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    int copyU4() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        int value = readU4();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        writeU4(value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    void copy(int count) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        for (int i = 0; i < count; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            gen[genPos++] = orig[inputPos++];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    void skip(int count) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        inputPos += count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    byte[] readBytes(int count) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        byte[] bytes = new byte[count];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        for (int i = 0; i < count; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            bytes[i] = orig[inputPos++];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        return bytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    void writeBytes(byte[] bytes) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        for (int i = 0; i < bytes.length; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            gen[genPos++] = bytes[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    byte[] inputBytes() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        return orig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    int inputPosition() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        return inputPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    void setInputPosition(int pos) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        inputPos = pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    void markLocalPositionStart() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        markPos = inputPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    int localPosition() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        return inputPos - markPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    void rewind() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        setInputPosition(markPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    int generatedPosition() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        return genPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    void randomAccessWriteU2(int pos, int val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        int savePos = genPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        genPos = pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        writeU2(val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        genPos = savePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    void randomAccessWriteU4(int pos, int val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        int savePos = genPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        genPos = pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        writeU4(val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        genPos = savePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    String constantPoolString(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        return constantPool[index];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    void copyConstantPool(int constantPoolCount){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        // copy const pool
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        constantPool = new String[constantPoolCount];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        // index zero not in class file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        for (int i = 1; i < constantPoolCount; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            int tag = readU1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            writeU1(tag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            switch (tag) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                case CONSTANT_CLASS:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                case CONSTANT_STRING:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                    copy(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                case CONSTANT_FIELD:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                case CONSTANT_METHOD:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                case CONSTANT_INTERFACEMETHOD:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                case CONSTANT_INTEGER:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                case CONSTANT_FLOAT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                case CONSTANT_NAMEANDTYPE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
                    copy(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                case CONSTANT_LONG:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                case CONSTANT_DOUBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                    copy(8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                    ++i;  // these take two CP entries - duh!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                case CONSTANT_UTF8:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                    int len = copyU2();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                    byte[] utf8 = readBytes(len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                    String str = null; // null to shut the compiler up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                        str = new String(utf8, "UTF-8");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
                    } catch (Exception exc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                        throw new Error("CP exception: " + exc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                    constantPool[i] = str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                    if (str.equals(codeAttributeName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                        codeAttributeIndex = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                    } else if (str.equals(lineNumberAttributeName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                        lineNumberAttributeIndex = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                    } else if (str.equals(localVarAttributeName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                        localVarAttributeIndex = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
                    writeBytes(utf8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                    throw new Error(i + " unexpected CP tag: " + tag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
}