jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/org/objectweb/asm/ClassReader.java
author mkos
Sun, 30 Dec 2012 00:00:00 +0100
changeset 22678 ac1ea46be942
parent 12009 4abb694f273a
permissions -rw-r--r--
8029237: Update copyright year to match last edit in jaxws repository for 2012 Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     1
/*
22678
ac1ea46be942 8029237: Update copyright year to match last edit in jaxws repository for 2012
mkos
parents: 12009
diff changeset
     2
 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     4
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    10
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    15
 * accompanied this code).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    16
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    20
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    23
 * questions.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    24
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    25
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    26
/*
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    27
 * This file is available under and governed by the GNU General Public
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    28
 * License version 2 only, as published by the Free Software Foundation.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    29
 * However, the following notice accompanied the original version of this
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    30
 * file:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    31
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    32
 * ASM: a very small and fast Java bytecode manipulation framework
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    33
 * Copyright (c) 2000-2007 INRIA, France Telecom
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    34
 * All rights reserved.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    35
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    36
 * Redistribution and use in source and binary forms, with or without
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    37
 * modification, are permitted provided that the following conditions
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    38
 * are met:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    39
 * 1. Redistributions of source code must retain the above copyright
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    40
 *    notice, this list of conditions and the following disclaimer.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    41
 * 2. Redistributions in binary form must reproduce the above copyright
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    42
 *    notice, this list of conditions and the following disclaimer in the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    43
 *    documentation and/or other materials provided with the distribution.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    44
 * 3. Neither the name of the copyright holders nor the names of its
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    45
 *    contributors may be used to endorse or promote products derived from
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    46
 *    this software without specific prior written permission.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    47
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    48
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    49
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    50
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    51
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    52
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    53
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    54
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    55
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    56
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    57
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    58
 * THE POSSIBILITY OF SUCH DAMAGE.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    59
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    60
package com.sun.xml.internal.ws.org.objectweb.asm;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    61
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    62
import java.io.InputStream;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    63
import java.io.IOException;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    64
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    65
/**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    66
 * A Java class parser to make a {@link ClassVisitor} visit an existing class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    67
 * This class parses a byte array conforming to the Java class file format and
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    68
 * calls the appropriate visit methods of a given class visitor for each field,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    69
 * method and bytecode instruction encountered.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    70
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    71
 * @author Eric Bruneton
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    72
 * @author Eugene Kuleshov
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    73
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    74
public class ClassReader {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    75
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    76
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    77
     * True to enable signatures support.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    78
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    79
    static final boolean SIGNATURES = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    80
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    81
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    82
     * True to enable annotations support.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    83
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    84
    static final boolean ANNOTATIONS = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    85
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    86
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    87
     * True to enable stack map frames support.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    88
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    89
    static final boolean FRAMES = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    90
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    91
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    92
     * True to enable bytecode writing support.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    93
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    94
    static final boolean WRITER = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    95
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    96
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    97
     * True to enable JSR_W and GOTO_W support.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    98
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    99
    static final boolean RESIZE = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   100
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   101
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   102
     * Flag to skip method code. If this class is set <code>CODE</code>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   103
     * attribute won't be visited. This can be used, for example, to retrieve
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   104
     * annotations for methods and method parameters.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   105
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   106
    public static final int SKIP_CODE = 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   107
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   108
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   109
     * Flag to skip the debug information in the class. If this flag is set the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   110
     * debug information of the class is not visited, i.e. the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   111
     * {@link MethodVisitor#visitLocalVariable visitLocalVariable} and
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   112
     * {@link MethodVisitor#visitLineNumber visitLineNumber} methods will not be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   113
     * called.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   114
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   115
    public static final int SKIP_DEBUG = 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   116
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   117
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   118
     * Flag to skip the stack map frames in the class. If this flag is set the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   119
     * stack map frames of the class is not visited, i.e. the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   120
     * {@link MethodVisitor#visitFrame visitFrame} method will not be called.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   121
     * This flag is useful when the {@link ClassWriter#COMPUTE_FRAMES} option is
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   122
     * used: it avoids visiting frames that will be ignored and recomputed from
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   123
     * scratch in the class writer.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   124
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   125
    public static final int SKIP_FRAMES = 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   126
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   127
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   128
     * Flag to expand the stack map frames. By default stack map frames are
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   129
     * visited in their original format (i.e. "expanded" for classes whose
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   130
     * version is less than V1_6, and "compressed" for the other classes). If
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   131
     * this flag is set, stack map frames are always visited in expanded format
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   132
     * (this option adds a decompression/recompression step in ClassReader and
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   133
     * ClassWriter which degrades performances quite a lot).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   134
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   135
    public static final int EXPAND_FRAMES = 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   136
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   137
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   138
     * The class to be parsed. <i>The content of this array must not be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   139
     * modified. This field is intended for {@link Attribute} sub classes, and
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   140
     * is normally not needed by class generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   141
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   142
    public final byte[] b;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   143
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   144
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   145
     * The start index of each constant pool item in {@link #b b}, plus one.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   146
     * The one byte offset skips the constant pool item tag that indicates its
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   147
     * type.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   148
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   149
    private final int[] items;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   150
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   151
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   152
     * The String objects corresponding to the CONSTANT_Utf8 items. This cache
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   153
     * avoids multiple parsing of a given CONSTANT_Utf8 constant pool item,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   154
     * which GREATLY improves performances (by a factor 2 to 3). This caching
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   155
     * strategy could be extended to all constant pool items, but its benefit
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   156
     * would not be so great for these items (because they are much less
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   157
     * expensive to parse than CONSTANT_Utf8 items).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   158
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   159
    private final String[] strings;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   160
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   161
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   162
     * Maximum length of the strings contained in the constant pool of the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   163
     * class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   164
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   165
    private final int maxStringLength;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   166
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   167
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   168
     * Start index of the class header information (access, name...) in
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   169
     * {@link #b b}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   170
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   171
    public final int header;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   172
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   173
    // ------------------------------------------------------------------------
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   174
    // Constructors
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   175
    // ------------------------------------------------------------------------
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   176
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   177
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   178
     * Constructs a new {@link ClassReader} object.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   179
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   180
     * @param b the bytecode of the class to be read.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   181
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   182
    public ClassReader(final byte[] b) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   183
        this(b, 0, b.length);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   184
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   185
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   186
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   187
     * Constructs a new {@link ClassReader} object.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   188
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   189
     * @param b the bytecode of the class to be read.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   190
     * @param off the start offset of the class data.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   191
     * @param len the length of the class data.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   192
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   193
    public ClassReader(final byte[] b, final int off, final int len) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   194
        this.b = b;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   195
        // parses the constant pool
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   196
        items = new int[readUnsignedShort(off + 8)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   197
        int n = items.length;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   198
        strings = new String[n];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   199
        int max = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   200
        int index = off + 10;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   201
        for (int i = 1; i < n; ++i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   202
            items[i] = index + 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   203
            int size;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   204
            switch (b[index]) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   205
                case ClassWriter.FIELD:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   206
                case ClassWriter.METH:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   207
                case ClassWriter.IMETH:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   208
                case ClassWriter.INT:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   209
                case ClassWriter.FLOAT:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   210
                case ClassWriter.NAME_TYPE:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   211
                    size = 5;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   212
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   213
                case ClassWriter.LONG:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   214
                case ClassWriter.DOUBLE:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   215
                    size = 9;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   216
                    ++i;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   217
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   218
                case ClassWriter.UTF8:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   219
                    size = 3 + readUnsignedShort(index + 1);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   220
                    if (size > max) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   221
                        max = size;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   222
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   223
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   224
                // case ClassWriter.CLASS:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   225
                // case ClassWriter.STR:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   226
                default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   227
                    size = 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   228
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   229
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   230
            index += size;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   231
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   232
        maxStringLength = max;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   233
        // the class header information starts just after the constant pool
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   234
        header = index;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   235
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   236
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   237
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   238
     * Returns the class's access flags (see {@link Opcodes}). This value may
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   239
     * not reflect Deprecated and Synthetic flags when bytecode is before 1.5
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   240
     * and those flags are represented by attributes.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   241
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   242
     * @return the class access flags
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   243
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   244
     * @see ClassVisitor#visit(int, int, String, String, String, String[])
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   245
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   246
    public int getAccess() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   247
        return readUnsignedShort(header);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   248
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   249
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   250
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   251
     * Returns the internal name of the class (see
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   252
     * {@link Type#getInternalName() getInternalName}).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   253
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   254
     * @return the internal class name
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   255
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   256
     * @see ClassVisitor#visit(int, int, String, String, String, String[])
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   257
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   258
    public String getClassName() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   259
        return readClass(header + 2, new char[maxStringLength]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   260
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   261
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   262
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   263
     * Returns the internal of name of the super class (see
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   264
     * {@link Type#getInternalName() getInternalName}). For interfaces, the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   265
     * super class is {@link Object}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   266
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   267
     * @return the internal name of super class, or <tt>null</tt> for
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   268
     *         {@link Object} class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   269
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   270
     * @see ClassVisitor#visit(int, int, String, String, String, String[])
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   271
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   272
    public String getSuperName() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   273
        int n = items[readUnsignedShort(header + 4)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   274
        return n == 0 ? null : readUTF8(n, new char[maxStringLength]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   275
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   276
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   277
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   278
     * Returns the internal names of the class's interfaces (see
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   279
     * {@link Type#getInternalName() getInternalName}).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   280
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   281
     * @return the array of internal names for all implemented interfaces or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   282
     *         <tt>null</tt>.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   283
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   284
     * @see ClassVisitor#visit(int, int, String, String, String, String[])
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   285
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   286
    public String[] getInterfaces() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   287
        int index = header + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   288
        int n = readUnsignedShort(index);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   289
        String[] interfaces = new String[n];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   290
        if (n > 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   291
            char[] buf = new char[maxStringLength];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   292
            for (int i = 0; i < n; ++i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   293
                index += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   294
                interfaces[i] = readClass(index, buf);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   295
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   296
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   297
        return interfaces;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   298
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   299
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   300
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   301
     * Copies the constant pool data into the given {@link ClassWriter}. Should
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   302
     * be called before the {@link #accept(ClassVisitor,int)} method.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   303
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   304
     * @param classWriter the {@link ClassWriter} to copy constant pool into.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   305
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   306
    void copyPool(final ClassWriter classWriter) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   307
        char[] buf = new char[maxStringLength];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   308
        int ll = items.length;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   309
        Item[] items2 = new Item[ll];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   310
        for (int i = 1; i < ll; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   311
            int index = items[i];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   312
            int tag = b[index - 1];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   313
            Item item = new Item(i);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   314
            int nameType;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   315
            switch (tag) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   316
                case ClassWriter.FIELD:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   317
                case ClassWriter.METH:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   318
                case ClassWriter.IMETH:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   319
                    nameType = items[readUnsignedShort(index + 2)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   320
                    item.set(tag,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   321
                            readClass(index, buf),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   322
                            readUTF8(nameType, buf),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   323
                            readUTF8(nameType + 2, buf));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   324
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   325
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   326
                case ClassWriter.INT:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   327
                    item.set(readInt(index));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   328
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   329
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   330
                case ClassWriter.FLOAT:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   331
                    item.set(Float.intBitsToFloat(readInt(index)));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   332
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   333
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   334
                case ClassWriter.NAME_TYPE:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   335
                    item.set(tag,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   336
                            readUTF8(index, buf),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   337
                            readUTF8(index + 2, buf),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   338
                            null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   339
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   340
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   341
                case ClassWriter.LONG:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   342
                    item.set(readLong(index));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   343
                    ++i;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   344
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   345
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   346
                case ClassWriter.DOUBLE:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   347
                    item.set(Double.longBitsToDouble(readLong(index)));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   348
                    ++i;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   349
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   350
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   351
                case ClassWriter.UTF8: {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   352
                    String s = strings[i];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   353
                    if (s == null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   354
                        index = items[i];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   355
                        s = strings[i] = readUTF(index + 2,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   356
                                readUnsignedShort(index),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   357
                                buf);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   358
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   359
                    item.set(tag, s, null, null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   360
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   361
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   362
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   363
                // case ClassWriter.STR:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   364
                // case ClassWriter.CLASS:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   365
                default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   366
                    item.set(tag, readUTF8(index, buf), null, null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   367
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   368
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   369
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   370
            int index2 = item.hashCode % items2.length;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   371
            item.next = items2[index2];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   372
            items2[index2] = item;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   373
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   374
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   375
        int off = items[1] - 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   376
        classWriter.pool.putByteArray(b, off, header - off);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   377
        classWriter.items = items2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   378
        classWriter.threshold = (int) (0.75d * ll);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   379
        classWriter.index = ll;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   380
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   381
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   382
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   383
     * Constructs a new {@link ClassReader} object.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   384
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   385
     * @param is an input stream from which to read the class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   386
     * @throws IOException if a problem occurs during reading.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   387
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   388
    public ClassReader(final InputStream is) throws IOException {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   389
        this(readClass(is));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   390
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   391
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   392
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   393
     * Constructs a new {@link ClassReader} object.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   394
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   395
     * @param name the fully qualified name of the class to be read.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   396
     * @throws IOException if an exception occurs during reading.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   397
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   398
    public ClassReader(final String name) throws IOException {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   399
        this(ClassLoader.getSystemResourceAsStream(name.replace('.', '/')
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   400
                + ".class"));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   401
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   402
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   403
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   404
     * Reads the bytecode of a class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   405
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   406
     * @param is an input stream from which to read the class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   407
     * @return the bytecode read from the given input stream.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   408
     * @throws IOException if a problem occurs during reading.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   409
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   410
    private static byte[] readClass(final InputStream is) throws IOException {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   411
        if (is == null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   412
            throw new IOException("Class not found");
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   413
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   414
        byte[] b = new byte[is.available()];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   415
        int len = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   416
        while (true) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   417
            int n = is.read(b, len, b.length - len);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   418
            if (n == -1) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   419
                if (len < b.length) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   420
                    byte[] c = new byte[len];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   421
                    System.arraycopy(b, 0, c, 0, len);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   422
                    b = c;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   423
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   424
                return b;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   425
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   426
            len += n;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   427
            if (len == b.length) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   428
                byte[] c = new byte[b.length + 1000];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   429
                System.arraycopy(b, 0, c, 0, len);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   430
                b = c;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   431
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   432
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   433
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   434
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   435
    // ------------------------------------------------------------------------
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   436
    // Public methods
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   437
    // ------------------------------------------------------------------------
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   438
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   439
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   440
     * Makes the given visitor visit the Java class of this {@link ClassReader}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   441
     * This class is the one specified in the constructor (see
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   442
     * {@link #ClassReader(byte[]) ClassReader}).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   443
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   444
     * @param classVisitor the visitor that must visit this class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   445
     * @param flags option flags that can be used to modify the default behavior
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   446
     *        of this class. See {@link #SKIP_DEBUG}, {@link #EXPAND_FRAMES},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   447
     *        {@link #SKIP_FRAMES}, {@link #SKIP_CODE}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   448
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   449
    public void accept(final ClassVisitor classVisitor, final int flags) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   450
        accept(classVisitor, new Attribute[0], flags);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   451
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   452
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   453
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   454
     * Makes the given visitor visit the Java class of this {@link ClassReader}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   455
     * This class is the one specified in the constructor (see
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   456
     * {@link #ClassReader(byte[]) ClassReader}).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   457
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   458
     * @param classVisitor the visitor that must visit this class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   459
     * @param attrs prototypes of the attributes that must be parsed during the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   460
     *        visit of the class. Any attribute whose type is not equal to the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   461
     *        type of one the prototypes will not be parsed: its byte array
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   462
     *        value will be passed unchanged to the ClassWriter. <i>This may
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   463
     *        corrupt it if this value contains references to the constant pool,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   464
     *        or has syntactic or semantic links with a class element that has
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   465
     *        been transformed by a class adapter between the reader and the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   466
     *        writer</i>.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   467
     * @param flags option flags that can be used to modify the default behavior
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   468
     *        of this class. See {@link #SKIP_DEBUG}, {@link #EXPAND_FRAMES},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   469
     *        {@link #SKIP_FRAMES}, {@link #SKIP_CODE}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   470
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   471
    public void accept(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   472
        final ClassVisitor classVisitor,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   473
        final Attribute[] attrs,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   474
        final int flags)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   475
    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   476
        byte[] b = this.b; // the bytecode array
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   477
        char[] c = new char[maxStringLength]; // buffer used to read strings
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   478
        int i, j, k; // loop variables
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   479
        int u, v, w; // indexes in b
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   480
        Attribute attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   481
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   482
        int access;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   483
        String name;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   484
        String desc;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   485
        String attrName;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   486
        String signature;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   487
        int anns = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   488
        int ianns = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   489
        Attribute cattrs = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   490
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   491
        // visits the header
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   492
        u = header;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   493
        access = readUnsignedShort(u);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   494
        name = readClass(u + 2, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   495
        v = items[readUnsignedShort(u + 4)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   496
        String superClassName = v == 0 ? null : readUTF8(v, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   497
        String[] implementedItfs = new String[readUnsignedShort(u + 6)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   498
        w = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   499
        u += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   500
        for (i = 0; i < implementedItfs.length; ++i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   501
            implementedItfs[i] = readClass(u, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   502
            u += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   503
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   504
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   505
        boolean skipCode = (flags & SKIP_CODE) != 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   506
        boolean skipDebug = (flags & SKIP_DEBUG) != 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   507
        boolean unzip = (flags & EXPAND_FRAMES) != 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   508
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   509
        // skips fields and methods
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   510
        v = u;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   511
        i = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   512
        v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   513
        for (; i > 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   514
            j = readUnsignedShort(v + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   515
            v += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   516
            for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   517
                v += 6 + readInt(v + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   518
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   519
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   520
        i = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   521
        v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   522
        for (; i > 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   523
            j = readUnsignedShort(v + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   524
            v += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   525
            for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   526
                v += 6 + readInt(v + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   527
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   528
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   529
        // reads the class's attributes
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   530
        signature = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   531
        String sourceFile = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   532
        String sourceDebug = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   533
        String enclosingOwner = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   534
        String enclosingName = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   535
        String enclosingDesc = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   536
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   537
        i = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   538
        v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   539
        for (; i > 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   540
            attrName = readUTF8(v, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   541
            // tests are sorted in decreasing frequency order
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   542
            // (based on frequencies observed on typical classes)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   543
            if ("SourceFile".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   544
                sourceFile = readUTF8(v + 6, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   545
            } else if ("InnerClasses".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   546
                w = v + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   547
            } else if ("EnclosingMethod".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   548
                enclosingOwner = readClass(v + 6, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   549
                int item = readUnsignedShort(v + 8);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   550
                if (item != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   551
                    enclosingName = readUTF8(items[item], c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   552
                    enclosingDesc = readUTF8(items[item] + 2, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   553
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   554
            } else if (SIGNATURES && "Signature".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   555
                signature = readUTF8(v + 6, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   556
            } else if (ANNOTATIONS && "RuntimeVisibleAnnotations".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   557
                anns = v + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   558
            } else if ("Deprecated".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   559
                access |= Opcodes.ACC_DEPRECATED;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   560
            } else if ("Synthetic".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   561
                access |= Opcodes.ACC_SYNTHETIC;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   562
            } else if ("SourceDebugExtension".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   563
                int len = readInt(v + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   564
                sourceDebug = readUTF(v + 6, len, new char[len]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   565
            } else if (ANNOTATIONS && "RuntimeInvisibleAnnotations".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   566
                ianns = v + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   567
            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   568
                attr = readAttribute(attrs,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   569
                        attrName,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   570
                        v + 6,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   571
                        readInt(v + 2),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   572
                        c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   573
                        -1,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   574
                        null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   575
                if (attr != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   576
                    attr.next = cattrs;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   577
                    cattrs = attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   578
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   579
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   580
            v += 6 + readInt(v + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   581
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   582
        // calls the visit method
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   583
        classVisitor.visit(readInt(4),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   584
                access,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   585
                name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   586
                signature,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   587
                superClassName,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   588
                implementedItfs);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   589
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   590
        // calls the visitSource method
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   591
        if (!skipDebug && (sourceFile != null || sourceDebug != null)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   592
            classVisitor.visitSource(sourceFile, sourceDebug);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   593
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   594
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   595
        // calls the visitOuterClass method
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   596
        if (enclosingOwner != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   597
            classVisitor.visitOuterClass(enclosingOwner,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   598
                    enclosingName,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   599
                    enclosingDesc);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   600
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   601
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   602
        // visits the class annotations
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   603
        if (ANNOTATIONS) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   604
            for (i = 1; i >= 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   605
                v = i == 0 ? ianns : anns;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   606
                if (v != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   607
                    j = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   608
                    v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   609
                    for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   610
                        v = readAnnotationValues(v + 2,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   611
                                c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   612
                                true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   613
                                classVisitor.visitAnnotation(readUTF8(v, c), i != 0));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   614
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   615
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   616
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   617
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   618
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   619
        // visits the class attributes
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   620
        while (cattrs != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   621
            attr = cattrs.next;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   622
            cattrs.next = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   623
            classVisitor.visitAttribute(cattrs);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   624
            cattrs = attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   625
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   626
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   627
        // calls the visitInnerClass method
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   628
        if (w != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   629
            i = readUnsignedShort(w);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   630
            w += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   631
            for (; i > 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   632
                classVisitor.visitInnerClass(readUnsignedShort(w) == 0
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   633
                        ? null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   634
                        : readClass(w, c), readUnsignedShort(w + 2) == 0
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   635
                        ? null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   636
                        : readClass(w + 2, c), readUnsignedShort(w + 4) == 0
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   637
                        ? null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   638
                        : readUTF8(w + 4, c), readUnsignedShort(w + 6));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   639
                w += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   640
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   641
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   642
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   643
        // visits the fields
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   644
        i = readUnsignedShort(u);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   645
        u += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   646
        for (; i > 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   647
            access = readUnsignedShort(u);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   648
            name = readUTF8(u + 2, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   649
            desc = readUTF8(u + 4, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   650
            // visits the field's attributes and looks for a ConstantValue
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   651
            // attribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   652
            int fieldValueItem = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   653
            signature = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   654
            anns = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   655
            ianns = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   656
            cattrs = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   657
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   658
            j = readUnsignedShort(u + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   659
            u += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   660
            for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   661
                attrName = readUTF8(u, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   662
                // tests are sorted in decreasing frequency order
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   663
                // (based on frequencies observed on typical classes)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   664
                if ("ConstantValue".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   665
                    fieldValueItem = readUnsignedShort(u + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   666
                } else if (SIGNATURES && "Signature".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   667
                    signature = readUTF8(u + 6, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   668
                } else if ("Deprecated".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   669
                    access |= Opcodes.ACC_DEPRECATED;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   670
                } else if ("Synthetic".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   671
                    access |= Opcodes.ACC_SYNTHETIC;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   672
                } else if (ANNOTATIONS && "RuntimeVisibleAnnotations".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   673
                    anns = u + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   674
                } else if (ANNOTATIONS && "RuntimeInvisibleAnnotations".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   675
                    ianns = u + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   676
                } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   677
                    attr = readAttribute(attrs,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   678
                            attrName,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   679
                            u + 6,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   680
                            readInt(u + 2),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   681
                            c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   682
                            -1,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   683
                            null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   684
                    if (attr != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   685
                        attr.next = cattrs;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   686
                        cattrs = attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   687
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   688
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   689
                u += 6 + readInt(u + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   690
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   691
            // visits the field
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   692
            FieldVisitor fv = classVisitor.visitField(access,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   693
                    name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   694
                    desc,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   695
                    signature,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   696
                    fieldValueItem == 0 ? null : readConst(fieldValueItem, c));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   697
            // visits the field annotations and attributes
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   698
            if (fv != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   699
                if (ANNOTATIONS) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   700
                    for (j = 1; j >= 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   701
                        v = j == 0 ? ianns : anns;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   702
                        if (v != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   703
                            k = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   704
                            v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   705
                            for (; k > 0; --k) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   706
                                v = readAnnotationValues(v + 2,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   707
                                        c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   708
                                        true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   709
                                        fv.visitAnnotation(readUTF8(v, c), j != 0));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   710
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   711
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   712
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   713
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   714
                while (cattrs != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   715
                    attr = cattrs.next;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   716
                    cattrs.next = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   717
                    fv.visitAttribute(cattrs);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   718
                    cattrs = attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   719
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   720
                fv.visitEnd();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   721
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   722
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   723
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   724
        // visits the methods
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   725
        i = readUnsignedShort(u);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   726
        u += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   727
        for (; i > 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   728
            int u0 = u + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   729
            access = readUnsignedShort(u);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   730
            name = readUTF8(u + 2, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   731
            desc = readUTF8(u + 4, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   732
            signature = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   733
            anns = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   734
            ianns = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   735
            int dann = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   736
            int mpanns = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   737
            int impanns = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   738
            cattrs = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   739
            v = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   740
            w = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   741
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   742
            // looks for Code and Exceptions attributes
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   743
            j = readUnsignedShort(u + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   744
            u += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   745
            for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   746
                attrName = readUTF8(u, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   747
                int attrSize = readInt(u + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   748
                u += 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   749
                // tests are sorted in decreasing frequency order
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   750
                // (based on frequencies observed on typical classes)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   751
                if ("Code".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   752
                    if (!skipCode) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   753
                        v = u;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   754
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   755
                } else if ("Exceptions".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   756
                    w = u;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   757
                } else if (SIGNATURES && "Signature".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   758
                    signature = readUTF8(u, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   759
                } else if ("Deprecated".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   760
                    access |= Opcodes.ACC_DEPRECATED;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   761
                } else if (ANNOTATIONS && "RuntimeVisibleAnnotations".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   762
                    anns = u;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   763
                } else if (ANNOTATIONS && "AnnotationDefault".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   764
                    dann = u;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   765
                } else if ("Synthetic".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   766
                    access |= Opcodes.ACC_SYNTHETIC;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   767
                } else if (ANNOTATIONS && "RuntimeInvisibleAnnotations".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   768
                    ianns = u;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   769
                } else if (ANNOTATIONS && "RuntimeVisibleParameterAnnotations".equals(attrName))
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   770
                {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   771
                    mpanns = u;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   772
                } else if (ANNOTATIONS && "RuntimeInvisibleParameterAnnotations".equals(attrName))
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   773
                {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   774
                    impanns = u;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   775
                } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   776
                    attr = readAttribute(attrs,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   777
                            attrName,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   778
                            u,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   779
                            attrSize,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   780
                            c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   781
                            -1,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   782
                            null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   783
                    if (attr != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   784
                        attr.next = cattrs;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   785
                        cattrs = attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   786
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   787
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   788
                u += attrSize;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   789
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   790
            // reads declared exceptions
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   791
            String[] exceptions;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   792
            if (w == 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   793
                exceptions = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   794
            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   795
                exceptions = new String[readUnsignedShort(w)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   796
                w += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   797
                for (j = 0; j < exceptions.length; ++j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   798
                    exceptions[j] = readClass(w, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   799
                    w += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   800
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   801
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   802
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   803
            // visits the method's code, if any
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   804
            MethodVisitor mv = classVisitor.visitMethod(access,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   805
                    name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   806
                    desc,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   807
                    signature,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   808
                    exceptions);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   809
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   810
            if (mv != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   811
                /*
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   812
                 * if the returned MethodVisitor is in fact a MethodWriter, it
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   813
                 * means there is no method adapter between the reader and the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   814
                 * writer. If, in addition, the writer's constant pool was
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   815
                 * copied from this reader (mw.cw.cr == this), and the signature
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   816
                 * and exceptions of the method have not been changed, then it
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   817
                 * is possible to skip all visit events and just copy the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   818
                 * original code of the method to the writer (the access, name
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   819
                 * and descriptor can have been changed, this is not important
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   820
                 * since they are not copied as is from the reader).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   821
                 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   822
                if (WRITER && mv instanceof MethodWriter) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   823
                    MethodWriter mw = (MethodWriter) mv;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   824
                    if (mw.cw.cr == this) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   825
                        if (signature == mw.signature) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   826
                            boolean sameExceptions = false;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   827
                            if (exceptions == null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   828
                                sameExceptions = mw.exceptionCount == 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   829
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   830
                                if (exceptions.length == mw.exceptionCount) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   831
                                    sameExceptions = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   832
                                    for (j = exceptions.length - 1; j >= 0; --j)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   833
                                    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   834
                                        w -= 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   835
                                        if (mw.exceptions[j] != readUnsignedShort(w))
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   836
                                        {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   837
                                            sameExceptions = false;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   838
                                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   839
                                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   840
                                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   841
                                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   842
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   843
                            if (sameExceptions) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   844
                                /*
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   845
                                 * we do not copy directly the code into
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   846
                                 * MethodWriter to save a byte array copy
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   847
                                 * operation. The real copy will be done in
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   848
                                 * ClassWriter.toByteArray().
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   849
                                 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   850
                                mw.classReaderOffset = u0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   851
                                mw.classReaderLength = u - u0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   852
                                continue;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   853
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   854
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   855
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   856
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   857
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   858
                if (ANNOTATIONS && dann != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   859
                    AnnotationVisitor dv = mv.visitAnnotationDefault();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   860
                    readAnnotationValue(dann, c, null, dv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   861
                    if (dv != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   862
                        dv.visitEnd();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   863
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   864
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   865
                if (ANNOTATIONS) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   866
                    for (j = 1; j >= 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   867
                        w = j == 0 ? ianns : anns;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   868
                        if (w != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   869
                            k = readUnsignedShort(w);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   870
                            w += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   871
                            for (; k > 0; --k) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   872
                                w = readAnnotationValues(w + 2,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   873
                                        c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   874
                                        true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   875
                                        mv.visitAnnotation(readUTF8(w, c), j != 0));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   876
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   877
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   878
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   879
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   880
                if (ANNOTATIONS && mpanns != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   881
                    readParameterAnnotations(mpanns, desc, c, true, mv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   882
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   883
                if (ANNOTATIONS && impanns != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   884
                    readParameterAnnotations(impanns, desc, c, false, mv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   885
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   886
                while (cattrs != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   887
                    attr = cattrs.next;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   888
                    cattrs.next = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   889
                    mv.visitAttribute(cattrs);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   890
                    cattrs = attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   891
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   892
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   893
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   894
            if (mv != null && v != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   895
                int maxStack = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   896
                int maxLocals = readUnsignedShort(v + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   897
                int codeLength = readInt(v + 4);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   898
                v += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   899
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   900
                int codeStart = v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   901
                int codeEnd = v + codeLength;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   902
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   903
                mv.visitCode();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   904
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   905
                // 1st phase: finds the labels
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   906
                int label;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   907
                Label[] labels = new Label[codeLength + 2];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   908
                readLabel(codeLength + 1, labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   909
                while (v < codeEnd) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   910
                    w = v - codeStart;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   911
                    int opcode = b[v] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   912
                    switch (ClassWriter.TYPE[opcode]) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   913
                        case ClassWriter.NOARG_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   914
                        case ClassWriter.IMPLVAR_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   915
                            v += 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   916
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   917
                        case ClassWriter.LABEL_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   918
                            readLabel(w + readShort(v + 1), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   919
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   920
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   921
                        case ClassWriter.LABELW_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   922
                            readLabel(w + readInt(v + 1), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   923
                            v += 5;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   924
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   925
                        case ClassWriter.WIDE_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   926
                            opcode = b[v + 1] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   927
                            if (opcode == Opcodes.IINC) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   928
                                v += 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   929
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   930
                                v += 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   931
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   932
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   933
                        case ClassWriter.TABL_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   934
                            // skips 0 to 3 padding bytes*
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   935
                            v = v + 4 - (w & 3);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   936
                            // reads instruction
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   937
                            readLabel(w + readInt(v), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   938
                            j = readInt(v + 8) - readInt(v + 4) + 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   939
                            v += 12;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   940
                            for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   941
                                readLabel(w + readInt(v), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   942
                                v += 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   943
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   944
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   945
                        case ClassWriter.LOOK_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   946
                            // skips 0 to 3 padding bytes*
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   947
                            v = v + 4 - (w & 3);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   948
                            // reads instruction
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   949
                            readLabel(w + readInt(v), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   950
                            j = readInt(v + 4);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   951
                            v += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   952
                            for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   953
                                readLabel(w + readInt(v + 4), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   954
                                v += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   955
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   956
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   957
                        case ClassWriter.VAR_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   958
                        case ClassWriter.SBYTE_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   959
                        case ClassWriter.LDC_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   960
                            v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   961
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   962
                        case ClassWriter.SHORT_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   963
                        case ClassWriter.LDCW_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   964
                        case ClassWriter.FIELDORMETH_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   965
                        case ClassWriter.TYPE_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   966
                        case ClassWriter.IINC_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   967
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   968
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   969
                        case ClassWriter.ITFMETH_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   970
                            v += 5;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   971
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   972
                        // case MANA_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   973
                        default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   974
                            v += 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   975
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   976
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   977
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   978
                // parses the try catch entries
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   979
                j = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   980
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   981
                for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   982
                    Label start = readLabel(readUnsignedShort(v), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   983
                    Label end = readLabel(readUnsignedShort(v + 2), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   984
                    Label handler = readLabel(readUnsignedShort(v + 4), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   985
                    int type = readUnsignedShort(v + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   986
                    if (type == 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   987
                        mv.visitTryCatchBlock(start, end, handler, null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   988
                    } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   989
                        mv.visitTryCatchBlock(start,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   990
                                end,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   991
                                handler,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   992
                                readUTF8(items[type], c));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   993
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   994
                    v += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   995
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   996
                // parses the local variable, line number tables, and code
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   997
                // attributes
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   998
                int varTable = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   999
                int varTypeTable = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1000
                int stackMap = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1001
                int frameCount = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1002
                int frameMode = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1003
                int frameOffset = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1004
                int frameLocalCount = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1005
                int frameLocalDiff = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1006
                int frameStackCount = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1007
                Object[] frameLocal = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1008
                Object[] frameStack = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1009
                boolean zip = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1010
                cattrs = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1011
                j = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1012
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1013
                for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1014
                    attrName = readUTF8(v, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1015
                    if ("LocalVariableTable".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1016
                        if (!skipDebug) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1017
                            varTable = v + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1018
                            k = readUnsignedShort(v + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1019
                            w = v + 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1020
                            for (; k > 0; --k) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1021
                                label = readUnsignedShort(w);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1022
                                if (labels[label] == null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1023
                                    readLabel(label, labels).status |= Label.DEBUG;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1024
                                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1025
                                label += readUnsignedShort(w + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1026
                                if (labels[label] == null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1027
                                    readLabel(label, labels).status |= Label.DEBUG;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1028
                                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1029
                                w += 10;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1030
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1031
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1032
                    } else if ("LocalVariableTypeTable".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1033
                        varTypeTable = v + 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1034
                    } else if ("LineNumberTable".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1035
                        if (!skipDebug) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1036
                            k = readUnsignedShort(v + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1037
                            w = v + 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1038
                            for (; k > 0; --k) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1039
                                label = readUnsignedShort(w);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1040
                                if (labels[label] == null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1041
                                    readLabel(label, labels).status |= Label.DEBUG;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1042
                                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1043
                                labels[label].line = readUnsignedShort(w + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1044
                                w += 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1045
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1046
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1047
                    } else if (FRAMES && "StackMapTable".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1048
                        if ((flags & SKIP_FRAMES) == 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1049
                            stackMap = v + 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1050
                            frameCount = readUnsignedShort(v + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1051
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1052
                        /*
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1053
                         * here we do not extract the labels corresponding to
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1054
                         * the attribute content. This would require a full
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1055
                         * parsing of the attribute, which would need to be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1056
                         * repeated in the second phase (see below). Instead the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1057
                         * content of the attribute is read one frame at a time
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1058
                         * (i.e. after a frame has been visited, the next frame
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1059
                         * is read), and the labels it contains are also
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1060
                         * extracted one frame at a time. Thanks to the ordering
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1061
                         * of frames, having only a "one frame lookahead" is not
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1062
                         * a problem, i.e. it is not possible to see an offset
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1063
                         * smaller than the offset of the current insn and for
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1064
                         * which no Label exist.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1065
                         */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1066
                        // TODO true for frame offsets,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1067
                        // but for UNINITIALIZED type offsets?
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1068
                    } else if (FRAMES && "StackMap".equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1069
                        if ((flags & SKIP_FRAMES) == 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1070
                            stackMap = v + 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1071
                            frameCount = readUnsignedShort(v + 6);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1072
                            zip = false;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1073
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1074
                        /*
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1075
                         * IMPORTANT! here we assume that the frames are
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1076
                         * ordered, as in the StackMapTable attribute, although
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1077
                         * this is not guaranteed by the attribute format.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1078
                         */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1079
                    } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1080
                        for (k = 0; k < attrs.length; ++k) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1081
                            if (attrs[k].type.equals(attrName)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1082
                                attr = attrs[k].read(this,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1083
                                        v + 6,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1084
                                        readInt(v + 2),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1085
                                        c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1086
                                        codeStart - 8,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1087
                                        labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1088
                                if (attr != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1089
                                    attr.next = cattrs;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1090
                                    cattrs = attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1091
                                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1092
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1093
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1094
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1095
                    v += 6 + readInt(v + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1096
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1097
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1098
                // 2nd phase: visits each instruction
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1099
                if (FRAMES && stackMap != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1100
                    // creates the very first (implicit) frame from the method
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1101
                    // descriptor
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1102
                    frameLocal = new Object[maxLocals];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1103
                    frameStack = new Object[maxStack];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1104
                    if (unzip) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1105
                        int local = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1106
                        if ((access & Opcodes.ACC_STATIC) == 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1107
                            if ("<init>".equals(name)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1108
                                frameLocal[local++] = Opcodes.UNINITIALIZED_THIS;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1109
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1110
                                frameLocal[local++] = readClass(header + 2, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1111
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1112
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1113
                        j = 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1114
                        loop: while (true) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1115
                            k = j;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1116
                            switch (desc.charAt(j++)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1117
                                case 'Z':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1118
                                case 'C':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1119
                                case 'B':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1120
                                case 'S':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1121
                                case 'I':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1122
                                    frameLocal[local++] = Opcodes.INTEGER;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1123
                                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1124
                                case 'F':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1125
                                    frameLocal[local++] = Opcodes.FLOAT;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1126
                                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1127
                                case 'J':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1128
                                    frameLocal[local++] = Opcodes.LONG;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1129
                                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1130
                                case 'D':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1131
                                    frameLocal[local++] = Opcodes.DOUBLE;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1132
                                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1133
                                case '[':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1134
                                    while (desc.charAt(j) == '[') {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1135
                                        ++j;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1136
                                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1137
                                    if (desc.charAt(j) == 'L') {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1138
                                        ++j;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1139
                                        while (desc.charAt(j) != ';') {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1140
                                            ++j;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1141
                                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1142
                                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1143
                                    frameLocal[local++] = desc.substring(k, ++j);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1144
                                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1145
                                case 'L':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1146
                                    while (desc.charAt(j) != ';') {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1147
                                        ++j;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1148
                                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1149
                                    frameLocal[local++] = desc.substring(k + 1,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1150
                                            j++);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1151
                                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1152
                                default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1153
                                    break loop;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1154
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1155
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1156
                        frameLocalCount = local;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1157
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1158
                    /*
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1159
                     * for the first explicit frame the offset is not
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1160
                     * offset_delta + 1 but only offset_delta; setting the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1161
                     * implicit frame offset to -1 allow the use of the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1162
                     * "offset_delta + 1" rule in all cases
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1163
                     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1164
                    frameOffset = -1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1165
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1166
                v = codeStart;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1167
                Label l;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1168
                while (v < codeEnd) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1169
                    w = v - codeStart;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1170
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1171
                    l = labels[w];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1172
                    if (l != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1173
                        mv.visitLabel(l);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1174
                        if (!skipDebug && l.line > 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1175
                            mv.visitLineNumber(l.line, l);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1176
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1177
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1178
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1179
                    while (FRAMES && frameLocal != null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1180
                            && (frameOffset == w || frameOffset == -1))
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1181
                    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1182
                        // if there is a frame for this offset,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1183
                        // makes the visitor visit it,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1184
                        // and reads the next frame if there is one.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1185
                        if (!zip || unzip) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1186
                            mv.visitFrame(Opcodes.F_NEW,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1187
                                    frameLocalCount,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1188
                                    frameLocal,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1189
                                    frameStackCount,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1190
                                    frameStack);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1191
                        } else if (frameOffset != -1) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1192
                            mv.visitFrame(frameMode,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1193
                                    frameLocalDiff,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1194
                                    frameLocal,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1195
                                    frameStackCount,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1196
                                    frameStack);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1197
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1198
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1199
                        if (frameCount > 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1200
                            int tag, delta, n;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1201
                            if (zip) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1202
                                tag = b[stackMap++] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1203
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1204
                                tag = MethodWriter.FULL_FRAME;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1205
                                frameOffset = -1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1206
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1207
                            frameLocalDiff = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1208
                            if (tag < MethodWriter.SAME_LOCALS_1_STACK_ITEM_FRAME)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1209
                            {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1210
                                delta = tag;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1211
                                frameMode = Opcodes.F_SAME;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1212
                                frameStackCount = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1213
                            } else if (tag < MethodWriter.RESERVED) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1214
                                delta = tag
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1215
                                        - MethodWriter.SAME_LOCALS_1_STACK_ITEM_FRAME;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1216
                                stackMap = readFrameType(frameStack,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1217
                                        0,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1218
                                        stackMap,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1219
                                        c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1220
                                        labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1221
                                frameMode = Opcodes.F_SAME1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1222
                                frameStackCount = 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1223
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1224
                                delta = readUnsignedShort(stackMap);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1225
                                stackMap += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1226
                                if (tag == MethodWriter.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1227
                                {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1228
                                    stackMap = readFrameType(frameStack,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1229
                                            0,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1230
                                            stackMap,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1231
                                            c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1232
                                            labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1233
                                    frameMode = Opcodes.F_SAME1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1234
                                    frameStackCount = 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1235
                                } else if (tag >= MethodWriter.CHOP_FRAME
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1236
                                        && tag < MethodWriter.SAME_FRAME_EXTENDED)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1237
                                {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1238
                                    frameMode = Opcodes.F_CHOP;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1239
                                    frameLocalDiff = MethodWriter.SAME_FRAME_EXTENDED
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1240
                                            - tag;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1241
                                    frameLocalCount -= frameLocalDiff;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1242
                                    frameStackCount = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1243
                                } else if (tag == MethodWriter.SAME_FRAME_EXTENDED)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1244
                                {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1245
                                    frameMode = Opcodes.F_SAME;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1246
                                    frameStackCount = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1247
                                } else if (tag < MethodWriter.FULL_FRAME) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1248
                                    j = unzip ? frameLocalCount : 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1249
                                    for (k = tag
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1250
                                            - MethodWriter.SAME_FRAME_EXTENDED; k > 0; k--)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1251
                                    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1252
                                        stackMap = readFrameType(frameLocal,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1253
                                                j++,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1254
                                                stackMap,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1255
                                                c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1256
                                                labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1257
                                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1258
                                    frameMode = Opcodes.F_APPEND;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1259
                                    frameLocalDiff = tag
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1260
                                            - MethodWriter.SAME_FRAME_EXTENDED;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1261
                                    frameLocalCount += frameLocalDiff;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1262
                                    frameStackCount = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1263
                                } else { // if (tag == FULL_FRAME) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1264
                                    frameMode = Opcodes.F_FULL;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1265
                                    n = frameLocalDiff = frameLocalCount = readUnsignedShort(stackMap);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1266
                                    stackMap += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1267
                                    for (j = 0; n > 0; n--) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1268
                                        stackMap = readFrameType(frameLocal,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1269
                                                j++,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1270
                                                stackMap,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1271
                                                c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1272
                                                labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1273
                                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1274
                                    n = frameStackCount = readUnsignedShort(stackMap);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1275
                                    stackMap += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1276
                                    for (j = 0; n > 0; n--) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1277
                                        stackMap = readFrameType(frameStack,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1278
                                                j++,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1279
                                                stackMap,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1280
                                                c,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1281
                                                labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1282
                                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1283
                                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1284
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1285
                            frameOffset += delta + 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1286
                            readLabel(frameOffset, labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1287
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1288
                            --frameCount;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1289
                        } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1290
                            frameLocal = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1291
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1292
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1293
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1294
                    int opcode = b[v] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1295
                    switch (ClassWriter.TYPE[opcode]) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1296
                        case ClassWriter.NOARG_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1297
                            mv.visitInsn(opcode);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1298
                            v += 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1299
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1300
                        case ClassWriter.IMPLVAR_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1301
                            if (opcode > Opcodes.ISTORE) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1302
                                opcode -= 59; // ISTORE_0
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1303
                                mv.visitVarInsn(Opcodes.ISTORE + (opcode >> 2),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1304
                                        opcode & 0x3);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1305
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1306
                                opcode -= 26; // ILOAD_0
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1307
                                mv.visitVarInsn(Opcodes.ILOAD + (opcode >> 2),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1308
                                        opcode & 0x3);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1309
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1310
                            v += 1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1311
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1312
                        case ClassWriter.LABEL_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1313
                            mv.visitJumpInsn(opcode, labels[w
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1314
                                    + readShort(v + 1)]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1315
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1316
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1317
                        case ClassWriter.LABELW_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1318
                            mv.visitJumpInsn(opcode - 33, labels[w
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1319
                                    + readInt(v + 1)]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1320
                            v += 5;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1321
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1322
                        case ClassWriter.WIDE_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1323
                            opcode = b[v + 1] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1324
                            if (opcode == Opcodes.IINC) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1325
                                mv.visitIincInsn(readUnsignedShort(v + 2),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1326
                                        readShort(v + 4));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1327
                                v += 6;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1328
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1329
                                mv.visitVarInsn(opcode,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1330
                                        readUnsignedShort(v + 2));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1331
                                v += 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1332
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1333
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1334
                        case ClassWriter.TABL_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1335
                            // skips 0 to 3 padding bytes
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1336
                            v = v + 4 - (w & 3);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1337
                            // reads instruction
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1338
                            label = w + readInt(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1339
                            int min = readInt(v + 4);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1340
                            int max = readInt(v + 8);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1341
                            v += 12;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1342
                            Label[] table = new Label[max - min + 1];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1343
                            for (j = 0; j < table.length; ++j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1344
                                table[j] = labels[w + readInt(v)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1345
                                v += 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1346
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1347
                            mv.visitTableSwitchInsn(min,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1348
                                    max,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1349
                                    labels[label],
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1350
                                    table);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1351
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1352
                        case ClassWriter.LOOK_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1353
                            // skips 0 to 3 padding bytes
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1354
                            v = v + 4 - (w & 3);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1355
                            // reads instruction
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1356
                            label = w + readInt(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1357
                            j = readInt(v + 4);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1358
                            v += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1359
                            int[] keys = new int[j];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1360
                            Label[] values = new Label[j];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1361
                            for (j = 0; j < keys.length; ++j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1362
                                keys[j] = readInt(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1363
                                values[j] = labels[w + readInt(v + 4)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1364
                                v += 8;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1365
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1366
                            mv.visitLookupSwitchInsn(labels[label],
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1367
                                    keys,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1368
                                    values);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1369
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1370
                        case ClassWriter.VAR_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1371
                            mv.visitVarInsn(opcode, b[v + 1] & 0xFF);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1372
                            v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1373
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1374
                        case ClassWriter.SBYTE_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1375
                            mv.visitIntInsn(opcode, b[v + 1]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1376
                            v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1377
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1378
                        case ClassWriter.SHORT_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1379
                            mv.visitIntInsn(opcode, readShort(v + 1));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1380
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1381
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1382
                        case ClassWriter.LDC_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1383
                            mv.visitLdcInsn(readConst(b[v + 1] & 0xFF, c));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1384
                            v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1385
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1386
                        case ClassWriter.LDCW_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1387
                            mv.visitLdcInsn(readConst(readUnsignedShort(v + 1),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1388
                                    c));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1389
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1390
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1391
                        case ClassWriter.FIELDORMETH_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1392
                        case ClassWriter.ITFMETH_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1393
                            int cpIndex = items[readUnsignedShort(v + 1)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1394
                            String iowner = readClass(cpIndex, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1395
                            cpIndex = items[readUnsignedShort(cpIndex + 2)];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1396
                            String iname = readUTF8(cpIndex, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1397
                            String idesc = readUTF8(cpIndex + 2, c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1398
                            if (opcode < Opcodes.INVOKEVIRTUAL) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1399
                                mv.visitFieldInsn(opcode, iowner, iname, idesc);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1400
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1401
                                mv.visitMethodInsn(opcode, iowner, iname, idesc);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1402
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1403
                            if (opcode == Opcodes.INVOKEINTERFACE) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1404
                                v += 5;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1405
                            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1406
                                v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1407
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1408
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1409
                        case ClassWriter.TYPE_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1410
                            mv.visitTypeInsn(opcode, readClass(v + 1, c));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1411
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1412
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1413
                        case ClassWriter.IINC_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1414
                            mv.visitIincInsn(b[v + 1] & 0xFF, b[v + 2]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1415
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1416
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1417
                        // case MANA_INSN:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1418
                        default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1419
                            mv.visitMultiANewArrayInsn(readClass(v + 1, c),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1420
                                    b[v + 3] & 0xFF);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1421
                            v += 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1422
                            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1423
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1424
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1425
                l = labels[codeEnd - codeStart];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1426
                if (l != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1427
                    mv.visitLabel(l);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1428
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1429
                // visits the local variable tables
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1430
                if (!skipDebug && varTable != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1431
                    int[] typeTable = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1432
                    if (varTypeTable != 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1433
                        k = readUnsignedShort(varTypeTable) * 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1434
                        w = varTypeTable + 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1435
                        typeTable = new int[k];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1436
                        while (k > 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1437
                            typeTable[--k] = w + 6; // signature
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1438
                            typeTable[--k] = readUnsignedShort(w + 8); // index
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1439
                            typeTable[--k] = readUnsignedShort(w); // start
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1440
                            w += 10;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1441
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1442
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1443
                    k = readUnsignedShort(varTable);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1444
                    w = varTable + 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1445
                    for (; k > 0; --k) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1446
                        int start = readUnsignedShort(w);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1447
                        int length = readUnsignedShort(w + 2);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1448
                        int index = readUnsignedShort(w + 8);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1449
                        String vsignature = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1450
                        if (typeTable != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1451
                            for (int a = 0; a < typeTable.length; a += 3) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1452
                                if (typeTable[a] == start
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1453
                                        && typeTable[a + 1] == index)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1454
                                {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1455
                                    vsignature = readUTF8(typeTable[a + 2], c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1456
                                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1457
                                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1458
                            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1459
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1460
                        mv.visitLocalVariable(readUTF8(w + 4, c),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1461
                                readUTF8(w + 6, c),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1462
                                vsignature,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1463
                                labels[start],
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1464
                                labels[start + length],
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1465
                                index);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1466
                        w += 10;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1467
                    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1468
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1469
                // visits the other attributes
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1470
                while (cattrs != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1471
                    attr = cattrs.next;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1472
                    cattrs.next = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1473
                    mv.visitAttribute(cattrs);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1474
                    cattrs = attr;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1475
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1476
                // visits the max stack and max locals values
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1477
                mv.visitMaxs(maxStack, maxLocals);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1478
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1479
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1480
            if (mv != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1481
                mv.visitEnd();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1482
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1483
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1484
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1485
        // visits the end of the class
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1486
        classVisitor.visitEnd();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1487
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1488
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1489
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1490
     * Reads parameter annotations and makes the given visitor visit them.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1491
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1492
     * @param v start offset in {@link #b b} of the annotations to be read.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1493
     * @param desc the method descriptor.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1494
     * @param buf buffer to be used to call {@link #readUTF8 readUTF8},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1495
     *        {@link #readClass(int,char[]) readClass} or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1496
     *        {@link #readConst readConst}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1497
     * @param visible <tt>true</tt> if the annotations to be read are visible
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1498
     *        at runtime.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1499
     * @param mv the visitor that must visit the annotations.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1500
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1501
    private void readParameterAnnotations(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1502
        int v,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1503
        final String desc,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1504
        final char[] buf,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1505
        final boolean visible,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1506
        final MethodVisitor mv)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1507
    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1508
        int i;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1509
        int n = b[v++] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1510
        // workaround for a bug in javac (javac compiler generates a parameter
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1511
        // annotation array whose size is equal to the number of parameters in
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1512
        // the Java source file, while it should generate an array whose size is
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1513
        // equal to the number of parameters in the method descriptor - which
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1514
        // includes the synthetic parameters added by the compiler). This work-
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1515
        // around supposes that the synthetic parameters are the first ones.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1516
        int synthetics = Type.getArgumentTypes(desc).length - n;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1517
        AnnotationVisitor av;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1518
        for (i = 0; i < synthetics; ++i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1519
            // virtual annotation to detect synthetic parameters in MethodWriter
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1520
            av = mv.visitParameterAnnotation(i, "Ljava/lang/Synthetic;", false);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1521
            if (av != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1522
                av.visitEnd();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1523
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1524
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1525
        for (; i < n + synthetics; ++i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1526
            int j = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1527
            v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1528
            for (; j > 0; --j) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1529
                av = mv.visitParameterAnnotation(i, readUTF8(v, buf), visible);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1530
                v = readAnnotationValues(v + 2, buf, true, av);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1531
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1532
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1533
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1534
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1535
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1536
     * Reads the values of an annotation and makes the given visitor visit them.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1537
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1538
     * @param v the start offset in {@link #b b} of the values to be read
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1539
     *        (including the unsigned short that gives the number of values).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1540
     * @param buf buffer to be used to call {@link #readUTF8 readUTF8},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1541
     *        {@link #readClass(int,char[]) readClass} or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1542
     *        {@link #readConst readConst}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1543
     * @param named if the annotation values are named or not.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1544
     * @param av the visitor that must visit the values.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1545
     * @return the end offset of the annotation values.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1546
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1547
    private int readAnnotationValues(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1548
        int v,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1549
        final char[] buf,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1550
        final boolean named,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1551
        final AnnotationVisitor av)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1552
    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1553
        int i = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1554
        v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1555
        if (named) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1556
            for (; i > 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1557
                v = readAnnotationValue(v + 2, buf, readUTF8(v, buf), av);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1558
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1559
        } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1560
            for (; i > 0; --i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1561
                v = readAnnotationValue(v, buf, null, av);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1562
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1563
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1564
        if (av != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1565
            av.visitEnd();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1566
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1567
        return v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1568
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1569
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1570
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1571
     * Reads a value of an annotation and makes the given visitor visit it.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1572
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1573
     * @param v the start offset in {@link #b b} of the value to be read (<i>not
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1574
     *        including the value name constant pool index</i>).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1575
     * @param buf buffer to be used to call {@link #readUTF8 readUTF8},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1576
     *        {@link #readClass(int,char[]) readClass} or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1577
     *        {@link #readConst readConst}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1578
     * @param name the name of the value to be read.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1579
     * @param av the visitor that must visit the value.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1580
     * @return the end offset of the annotation value.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1581
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1582
    private int readAnnotationValue(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1583
        int v,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1584
        final char[] buf,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1585
        final String name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1586
        final AnnotationVisitor av)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1587
    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1588
        int i;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1589
        if (av == null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1590
            switch (b[v] & 0xFF) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1591
                case 'e': // enum_const_value
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1592
                    return v + 5;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1593
                case '@': // annotation_value
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1594
                    return readAnnotationValues(v + 3, buf, true, null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1595
                case '[': // array_value
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1596
                    return readAnnotationValues(v + 1, buf, false, null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1597
                default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1598
                    return v + 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1599
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1600
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1601
        switch (b[v++] & 0xFF) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1602
            case 'I': // pointer to CONSTANT_Integer
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1603
            case 'J': // pointer to CONSTANT_Long
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1604
            case 'F': // pointer to CONSTANT_Float
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1605
            case 'D': // pointer to CONSTANT_Double
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1606
                av.visit(name, readConst(readUnsignedShort(v), buf));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1607
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1608
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1609
            case 'B': // pointer to CONSTANT_Byte
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1610
                av.visit(name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1611
                        new Byte((byte) readInt(items[readUnsignedShort(v)])));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1612
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1613
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1614
            case 'Z': // pointer to CONSTANT_Boolean
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1615
                av.visit(name, readInt(items[readUnsignedShort(v)]) == 0
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1616
                        ? Boolean.FALSE
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1617
                        : Boolean.TRUE);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1618
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1619
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1620
            case 'S': // pointer to CONSTANT_Short
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1621
                av.visit(name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1622
                        new Short((short) readInt(items[readUnsignedShort(v)])));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1623
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1624
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1625
            case 'C': // pointer to CONSTANT_Char
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1626
                av.visit(name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1627
                        new Character((char) readInt(items[readUnsignedShort(v)])));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1628
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1629
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1630
            case 's': // pointer to CONSTANT_Utf8
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1631
                av.visit(name, readUTF8(v, buf));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1632
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1633
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1634
            case 'e': // enum_const_value
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1635
                av.visitEnum(name, readUTF8(v, buf), readUTF8(v + 2, buf));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1636
                v += 4;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1637
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1638
            case 'c': // class_info
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1639
                av.visit(name, Type.getType(readUTF8(v, buf)));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1640
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1641
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1642
            case '@': // annotation_value
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1643
                v = readAnnotationValues(v + 2,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1644
                        buf,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1645
                        true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1646
                        av.visitAnnotation(name, readUTF8(v, buf)));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1647
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1648
            case '[': // array_value
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1649
                int size = readUnsignedShort(v);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1650
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1651
                if (size == 0) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1652
                    return readAnnotationValues(v - 2,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1653
                            buf,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1654
                            false,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1655
                            av.visitArray(name));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1656
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1657
                switch (this.b[v++] & 0xFF) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1658
                    case 'B':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1659
                        byte[] bv = new byte[size];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1660
                        for (i = 0; i < size; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1661
                            bv[i] = (byte) readInt(items[readUnsignedShort(v)]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1662
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1663
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1664
                        av.visit(name, bv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1665
                        --v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1666
                        break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1667
                    case 'Z':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1668
                        boolean[] zv = new boolean[size];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1669
                        for (i = 0; i < size; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1670
                            zv[i] = readInt(items[readUnsignedShort(v)]) != 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1671
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1672
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1673
                        av.visit(name, zv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1674
                        --v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1675
                        break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1676
                    case 'S':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1677
                        short[] sv = new short[size];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1678
                        for (i = 0; i < size; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1679
                            sv[i] = (short) readInt(items[readUnsignedShort(v)]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1680
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1681
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1682
                        av.visit(name, sv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1683
                        --v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1684
                        break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1685
                    case 'C':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1686
                        char[] cv = new char[size];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1687
                        for (i = 0; i < size; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1688
                            cv[i] = (char) readInt(items[readUnsignedShort(v)]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1689
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1690
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1691
                        av.visit(name, cv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1692
                        --v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1693
                        break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1694
                    case 'I':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1695
                        int[] iv = new int[size];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1696
                        for (i = 0; i < size; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1697
                            iv[i] = readInt(items[readUnsignedShort(v)]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1698
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1699
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1700
                        av.visit(name, iv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1701
                        --v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1702
                        break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1703
                    case 'J':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1704
                        long[] lv = new long[size];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1705
                        for (i = 0; i < size; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1706
                            lv[i] = readLong(items[readUnsignedShort(v)]);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1707
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1708
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1709
                        av.visit(name, lv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1710
                        --v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1711
                        break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1712
                    case 'F':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1713
                        float[] fv = new float[size];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1714
                        for (i = 0; i < size; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1715
                            fv[i] = Float.intBitsToFloat(readInt(items[readUnsignedShort(v)]));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1716
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1717
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1718
                        av.visit(name, fv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1719
                        --v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1720
                        break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1721
                    case 'D':
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1722
                        double[] dv = new double[size];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1723
                        for (i = 0; i < size; i++) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1724
                            dv[i] = Double.longBitsToDouble(readLong(items[readUnsignedShort(v)]));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1725
                            v += 3;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1726
                        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1727
                        av.visit(name, dv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1728
                        --v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1729
                        break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1730
                    default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1731
                        v = readAnnotationValues(v - 3,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1732
                                buf,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1733
                                false,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1734
                                av.visitArray(name));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1735
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1736
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1737
        return v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1738
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1739
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1740
    private int readFrameType(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1741
        final Object[] frame,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1742
        final int index,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1743
        int v,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1744
        final char[] buf,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1745
        final Label[] labels)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1746
    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1747
        int type = b[v++] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1748
        switch (type) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1749
            case 0:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1750
                frame[index] = Opcodes.TOP;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1751
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1752
            case 1:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1753
                frame[index] = Opcodes.INTEGER;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1754
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1755
            case 2:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1756
                frame[index] = Opcodes.FLOAT;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1757
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1758
            case 3:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1759
                frame[index] = Opcodes.DOUBLE;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1760
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1761
            case 4:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1762
                frame[index] = Opcodes.LONG;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1763
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1764
            case 5:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1765
                frame[index] = Opcodes.NULL;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1766
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1767
            case 6:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1768
                frame[index] = Opcodes.UNINITIALIZED_THIS;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1769
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1770
            case 7: // Object
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1771
                frame[index] = readClass(v, buf);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1772
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1773
                break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1774
            default: // Uninitialized
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1775
                frame[index] = readLabel(readUnsignedShort(v), labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1776
                v += 2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1777
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1778
        return v;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1779
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1780
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1781
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1782
     * Returns the label corresponding to the given offset. The default
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1783
     * implementation of this method creates a label for the given offset if it
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1784
     * has not been already created.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1785
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1786
     * @param offset a bytecode offset in a method.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1787
     * @param labels the already created labels, indexed by their offset. If a
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1788
     *        label already exists for offset this method must not create a new
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1789
     *        one. Otherwise it must store the new label in this array.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1790
     * @return a non null Label, which must be equal to labels[offset].
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1791
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1792
    protected Label readLabel(int offset, Label[] labels) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1793
        if (labels[offset] == null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1794
            labels[offset] = new Label();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1795
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1796
        return labels[offset];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1797
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1798
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1799
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1800
     * Reads an attribute in {@link #b b}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1801
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1802
     * @param attrs prototypes of the attributes that must be parsed during the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1803
     *        visit of the class. Any attribute whose type is not equal to the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1804
     *        type of one the prototypes is ignored (i.e. an empty
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1805
     *        {@link Attribute} instance is returned).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1806
     * @param type the type of the attribute.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1807
     * @param off index of the first byte of the attribute's content in
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1808
     *        {@link #b b}. The 6 attribute header bytes, containing the type
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1809
     *        and the length of the attribute, are not taken into account here
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1810
     *        (they have already been read).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1811
     * @param len the length of the attribute's content.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1812
     * @param buf buffer to be used to call {@link #readUTF8 readUTF8},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1813
     *        {@link #readClass(int,char[]) readClass} or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1814
     *        {@link #readConst readConst}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1815
     * @param codeOff index of the first byte of code's attribute content in
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1816
     *        {@link #b b}, or -1 if the attribute to be read is not a code
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1817
     *        attribute. The 6 attribute header bytes, containing the type and
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1818
     *        the length of the attribute, are not taken into account here.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1819
     * @param labels the labels of the method's code, or <tt>null</tt> if the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1820
     *        attribute to be read is not a code attribute.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1821
     * @return the attribute that has been read, or <tt>null</tt> to skip this
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1822
     *         attribute.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1823
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1824
    private Attribute readAttribute(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1825
        final Attribute[] attrs,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1826
        final String type,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1827
        final int off,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1828
        final int len,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1829
        final char[] buf,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1830
        final int codeOff,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1831
        final Label[] labels)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1832
    {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1833
        for (int i = 0; i < attrs.length; ++i) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1834
            if (attrs[i].type.equals(type)) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1835
                return attrs[i].read(this, off, len, buf, codeOff, labels);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1836
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1837
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1838
        return new Attribute(type).read(this, off, len, null, -1, null);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1839
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1840
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1841
    // ------------------------------------------------------------------------
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1842
    // Utility methods: low level parsing
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1843
    // ------------------------------------------------------------------------
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1844
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1845
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1846
     * Returns the start index of the constant pool item in {@link #b b}, plus
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1847
     * one. <i>This method is intended for {@link Attribute} sub classes, and is
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1848
     * normally not needed by class generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1849
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1850
     * @param item the index a constant pool item.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1851
     * @return the start index of the constant pool item in {@link #b b}, plus
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1852
     *         one.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1853
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1854
    public int getItem(final int item) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1855
        return items[item];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1856
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1857
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1858
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1859
     * Reads a byte value in {@link #b b}. <i>This method is intended for
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1860
     * {@link Attribute} sub classes, and is normally not needed by class
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1861
     * generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1862
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1863
     * @param index the start index of the value to be read in {@link #b b}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1864
     * @return the read value.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1865
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1866
    public int readByte(final int index) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1867
        return b[index] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1868
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1869
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1870
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1871
     * Reads an unsigned short value in {@link #b b}. <i>This method is
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1872
     * intended for {@link Attribute} sub classes, and is normally not needed by
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1873
     * class generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1874
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1875
     * @param index the start index of the value to be read in {@link #b b}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1876
     * @return the read value.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1877
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1878
    public int readUnsignedShort(final int index) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1879
        byte[] b = this.b;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1880
        return ((b[index] & 0xFF) << 8) | (b[index + 1] & 0xFF);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1881
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1882
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1883
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1884
     * Reads a signed short value in {@link #b b}. <i>This method is intended
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1885
     * for {@link Attribute} sub classes, and is normally not needed by class
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1886
     * generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1887
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1888
     * @param index the start index of the value to be read in {@link #b b}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1889
     * @return the read value.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1890
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1891
    public short readShort(final int index) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1892
        byte[] b = this.b;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1893
        return (short) (((b[index] & 0xFF) << 8) | (b[index + 1] & 0xFF));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1894
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1895
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1896
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1897
     * Reads a signed int value in {@link #b b}. <i>This method is intended for
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1898
     * {@link Attribute} sub classes, and is normally not needed by class
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1899
     * generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1900
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1901
     * @param index the start index of the value to be read in {@link #b b}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1902
     * @return the read value.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1903
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1904
    public int readInt(final int index) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1905
        byte[] b = this.b;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1906
        return ((b[index] & 0xFF) << 24) | ((b[index + 1] & 0xFF) << 16)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1907
                | ((b[index + 2] & 0xFF) << 8) | (b[index + 3] & 0xFF);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1908
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1909
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1910
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1911
     * Reads a signed long value in {@link #b b}. <i>This method is intended
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1912
     * for {@link Attribute} sub classes, and is normally not needed by class
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1913
     * generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1914
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1915
     * @param index the start index of the value to be read in {@link #b b}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1916
     * @return the read value.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1917
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1918
    public long readLong(final int index) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1919
        long l1 = readInt(index);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1920
        long l0 = readInt(index + 4) & 0xFFFFFFFFL;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1921
        return (l1 << 32) | l0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1922
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1923
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1924
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1925
     * Reads an UTF8 string constant pool item in {@link #b b}. <i>This method
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1926
     * is intended for {@link Attribute} sub classes, and is normally not needed
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1927
     * by class generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1928
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1929
     * @param index the start index of an unsigned short value in {@link #b b},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1930
     *        whose value is the index of an UTF8 constant pool item.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1931
     * @param buf buffer to be used to read the item. This buffer must be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1932
     *        sufficiently large. It is not automatically resized.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1933
     * @return the String corresponding to the specified UTF8 item.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1934
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1935
    public String readUTF8(int index, final char[] buf) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1936
        int item = readUnsignedShort(index);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1937
        String s = strings[item];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1938
        if (s != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1939
            return s;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1940
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1941
        index = items[item];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1942
        return strings[item] = readUTF(index + 2, readUnsignedShort(index), buf);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1943
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1944
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1945
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1946
     * Reads UTF8 string in {@link #b b}.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1947
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1948
     * @param index start offset of the UTF8 string to be read.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1949
     * @param utfLen length of the UTF8 string to be read.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1950
     * @param buf buffer to be used to read the string. This buffer must be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1951
     *        sufficiently large. It is not automatically resized.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1952
     * @return the String corresponding to the specified UTF8 string.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1953
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1954
    private String readUTF(int index, final int utfLen, final char[] buf) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1955
        int endIndex = index + utfLen;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1956
        byte[] b = this.b;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1957
        int strLen = 0;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1958
        int c, d, e;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1959
        while (index < endIndex) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1960
            c = b[index++] & 0xFF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1961
            switch (c >> 4) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1962
                case 0:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1963
                case 1:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1964
                case 2:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1965
                case 3:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1966
                case 4:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1967
                case 5:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1968
                case 6:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1969
                case 7:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1970
                    // 0xxxxxxx
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1971
                    buf[strLen++] = (char) c;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1972
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1973
                case 12:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1974
                case 13:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1975
                    // 110x xxxx 10xx xxxx
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1976
                    d = b[index++];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1977
                    buf[strLen++] = (char) (((c & 0x1F) << 6) | (d & 0x3F));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1978
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1979
                default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1980
                    // 1110 xxxx 10xx xxxx 10xx xxxx
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1981
                    d = b[index++];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1982
                    e = b[index++];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1983
                    buf[strLen++] = (char) (((c & 0x0F) << 12)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1984
                            | ((d & 0x3F) << 6) | (e & 0x3F));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1985
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1986
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1987
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1988
        return new String(buf, 0, strLen);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1989
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1990
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1991
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1992
     * Reads a class constant pool item in {@link #b b}. <i>This method is
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1993
     * intended for {@link Attribute} sub classes, and is normally not needed by
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1994
     * class generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1995
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1996
     * @param index the start index of an unsigned short value in {@link #b b},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1997
     *        whose value is the index of a class constant pool item.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1998
     * @param buf buffer to be used to read the item. This buffer must be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  1999
     *        sufficiently large. It is not automatically resized.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2000
     * @return the String corresponding to the specified class item.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2001
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2002
    public String readClass(final int index, final char[] buf) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2003
        // computes the start index of the CONSTANT_Class item in b
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2004
        // and reads the CONSTANT_Utf8 item designated by
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2005
        // the first two bytes of this CONSTANT_Class item
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2006
        return readUTF8(items[readUnsignedShort(index)], buf);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2007
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2008
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2009
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2010
     * Reads a numeric or string constant pool item in {@link #b b}. <i>This
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2011
     * method is intended for {@link Attribute} sub classes, and is normally not
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2012
     * needed by class generators or adapters.</i>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2013
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2014
     * @param item the index of a constant pool item.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2015
     * @param buf buffer to be used to read the item. This buffer must be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2016
     *        sufficiently large. It is not automatically resized.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2017
     * @return the {@link Integer}, {@link Float}, {@link Long},
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2018
     *         {@link Double}, {@link String} or {@link Type} corresponding to
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2019
     *         the given constant pool item.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2020
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2021
    public Object readConst(final int item, final char[] buf) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2022
        int index = items[item];
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2023
        switch (b[index - 1]) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2024
            case ClassWriter.INT:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2025
                return new Integer(readInt(index));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2026
            case ClassWriter.FLOAT:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2027
                return new Float(Float.intBitsToFloat(readInt(index)));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2028
            case ClassWriter.LONG:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2029
                return new Long(readLong(index));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2030
            case ClassWriter.DOUBLE:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2031
                return new Double(Double.longBitsToDouble(readLong(index)));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2032
            case ClassWriter.CLASS:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2033
                return Type.getObjectType(readUTF8(index, buf));
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2034
                // case ClassWriter.STR:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2035
            default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2036
                return readUTF8(index, buf);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2037
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2038
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
  2039
}