langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Descriptor.java
author vasya
Mon, 14 Dec 2015 20:18:19 +0100
changeset 34752 9c262a013456
parent 30846 2b3f379840f0
permissions -rw-r--r--
8145342: Some copyright notices are inconsistently and ill formatted Summary: Adjusted formatting of copyright notices. Reviewed-by: darcy, alundblad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
     1
/*
16560
c6c7f0c26568 8010361: fix some langtools findbugs issues
jjg
parents: 14263
diff changeset
     2
 * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
     4
 *
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    10
 *
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    15
 * accompanied this code).
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    16
 *
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    23
 * questions.
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    24
 */
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    25
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    26
package com.sun.tools.classfile;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    27
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    28
import java.io.IOException;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    29
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    30
/**
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5847
diff changeset
    31
 * See JVMS, section 4.4.
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    32
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    33
 *  <p><b>This is NOT part of any supported API.
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    34
 *  If you write code that depends on this, you do so at your own risk.
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    35
 *  This code and its internal interfaces are subject to change or
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    36
 *  deletion without notice.</b>
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    37
 */
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    38
public class Descriptor {
16560
c6c7f0c26568 8010361: fix some langtools findbugs issues
jjg
parents: 14263
diff changeset
    39
    public static class InvalidDescriptor extends DescriptorException {
1870
57a1138dffc8 6795903: fix latent build warnings in langtools repository
jjg
parents: 735
diff changeset
    40
        private static final long serialVersionUID = 1L;
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    41
        InvalidDescriptor(String desc) {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    42
            this.desc = desc;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    43
            this.index = -1;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    44
        }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    45
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    46
        InvalidDescriptor(String desc, int index) {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    47
            this.desc = desc;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    48
            this.index = index;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    49
        }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    50
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    51
        @Override
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    52
        public String getMessage() {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    53
            // i18n
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    54
            if (index == -1)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    55
                return "invalid descriptor \"" + desc + "\"";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    56
            else
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    57
                return "descriptor is invalid at offset " + index + " in \"" + desc + "\"";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    58
        }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    59
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    60
        public final String desc;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    61
        public final int index;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    62
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    63
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    64
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    65
    public Descriptor(ClassReader cr) throws IOException {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    66
        this(cr.readUnsignedShort());
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    67
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    68
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    69
    public Descriptor(int index) {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    70
        this.index = index;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    71
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    72
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    73
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    74
    public String getValue(ConstantPool constant_pool) throws ConstantPoolException {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    75
        return constant_pool.getUTF8Value(index);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    76
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    77
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    78
    public int getParameterCount(ConstantPool constant_pool)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    79
            throws ConstantPoolException, InvalidDescriptor {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    80
        String desc = getValue(constant_pool);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    81
        int end = desc.indexOf(")");
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    82
        if (end == -1)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    83
            throw new InvalidDescriptor(desc);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    84
        parse(desc, 0, end + 1);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    85
        return count;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    86
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    87
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    88
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    89
    public String getParameterTypes(ConstantPool constant_pool)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    90
            throws ConstantPoolException, InvalidDescriptor {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    91
        String desc = getValue(constant_pool);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    92
        int end = desc.indexOf(")");
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    93
        if (end == -1)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    94
            throw new InvalidDescriptor(desc);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    95
        return parse(desc, 0, end + 1);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    96
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    97
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    98
    public String getReturnType(ConstantPool constant_pool)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
    99
            throws ConstantPoolException, InvalidDescriptor {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   100
        String desc = getValue(constant_pool);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   101
        int end = desc.indexOf(")");
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   102
        if (end == -1)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   103
            throw new InvalidDescriptor(desc);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   104
        return parse(desc, end + 1, desc.length());
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   105
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   106
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   107
    public String getFieldType(ConstantPool constant_pool)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   108
            throws ConstantPoolException, InvalidDescriptor {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   109
        String desc = getValue(constant_pool);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   110
        return parse(desc, 0, desc.length());
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   111
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   112
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   113
    private String parse(String desc, int start, int end)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   114
            throws InvalidDescriptor {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   115
        int p = start;
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 9303
diff changeset
   116
        StringBuilder sb = new StringBuilder();
727
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   117
        int dims = 0;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   118
        count = 0;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   119
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   120
        while (p < end) {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   121
            String type;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   122
            char ch;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   123
            switch (ch = desc.charAt(p++)) {
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   124
                case '(':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   125
                    sb.append('(');
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   126
                    continue;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   127
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   128
                case ')':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   129
                    sb.append(')');
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   130
                    continue;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   131
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   132
                case '[':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   133
                    dims++;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   134
                    continue;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   135
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   136
                case 'B':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   137
                    type = "byte";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   138
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   139
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   140
                case 'C':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   141
                    type = "char";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   142
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   143
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   144
                case 'D':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   145
                    type = "double";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   146
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   147
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   148
                case 'F':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   149
                    type = "float";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   150
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   151
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   152
                case 'I':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   153
                    type = "int";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   154
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   155
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   156
                case 'J':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   157
                    type = "long";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   158
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   159
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   160
                case 'L':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   161
                    int sep = desc.indexOf(';', p);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   162
                    if (sep == -1)
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   163
                        throw new InvalidDescriptor(desc, p - 1);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   164
                    type = desc.substring(p, sep).replace('/', '.');
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   165
                    p = sep + 1;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   166
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   167
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   168
                case 'S':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   169
                    type = "short";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   170
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   171
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   172
                case 'Z':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   173
                    type = "boolean";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   174
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   175
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   176
                case 'V':
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   177
                    type = "void";
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   178
                    break;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   179
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   180
                default:
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   181
                    throw new InvalidDescriptor(desc, p - 1);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   182
            }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   183
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   184
            if (sb.length() > 1 && sb.charAt(0) == '(')
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   185
                sb.append(", ");
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   186
            sb.append(type);
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   187
            for ( ; dims > 0; dims-- )
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   188
                sb.append("[]");
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   189
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   190
            count++;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   191
        }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   192
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   193
        return sb.toString();
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   194
    }
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   195
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   196
    public final int index;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   197
    private int count;
cb50c1ae7bab 4075303: Use javap to enquire aboput a specific inner class
jjg
parents:
diff changeset
   198
}