1 /*
2 * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
50 case '[':
51 break; // Ok. signature char known
52 default:
53 Assert.that(false, "Unknown char in field signature \"" + signature.asString() + "\": " + this.first);
54 }
55 }
56 }
57
58 public boolean isOop() { return isObject() || isArray(); }
59 public boolean isByte() { return first == 'B'; }
60 public boolean isChar() { return first == 'C'; }
61 public boolean isDouble() { return first == 'D'; }
62 public boolean isFloat() { return first == 'F'; }
63 public boolean isInt() { return first == 'I'; }
64 public boolean isLong() { return first == 'J'; }
65 public boolean isShort() { return first == 'S'; }
66 public boolean isBoolean() { return first == 'Z'; }
67 public boolean isObject() { return first == 'L'; }
68 public boolean isArray() { return first == '['; }
69
70 public static class ArrayInfo {
71 private int dimension;
72 private int elementBasicType; // See BasicType.java
73 // FIXME: consider adding name of element class
74
75 public ArrayInfo(int dimension, int elementBasicType) {
76 this.dimension = dimension;
77 this.elementBasicType = elementBasicType;
78 }
79
80 public int dimension() { return dimension; }
81 /** See BasicType.java */
82 public int elementBasicType() { return elementBasicType; }
83 }
84
85 /** Only valid for T_ARRAY; throws unspecified exception otherwise */
86 public ArrayInfo getArrayInfo() {
87 int index = 1;
88 int dim = 1;
89 index = skipOptionalSize(signature, index);
|
1 /*
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
50 case '[':
51 break; // Ok. signature char known
52 default:
53 Assert.that(false, "Unknown char in field signature \"" + signature.asString() + "\": " + this.first);
54 }
55 }
56 }
57
58 public boolean isOop() { return isObject() || isArray(); }
59 public boolean isByte() { return first == 'B'; }
60 public boolean isChar() { return first == 'C'; }
61 public boolean isDouble() { return first == 'D'; }
62 public boolean isFloat() { return first == 'F'; }
63 public boolean isInt() { return first == 'I'; }
64 public boolean isLong() { return first == 'J'; }
65 public boolean isShort() { return first == 'S'; }
66 public boolean isBoolean() { return first == 'Z'; }
67 public boolean isObject() { return first == 'L'; }
68 public boolean isArray() { return first == '['; }
69
70 public Symbol getSignature() { return signature; }
71
72 public static class ArrayInfo {
73 private int dimension;
74 private int elementBasicType; // See BasicType.java
75 // FIXME: consider adding name of element class
76
77 public ArrayInfo(int dimension, int elementBasicType) {
78 this.dimension = dimension;
79 this.elementBasicType = elementBasicType;
80 }
81
82 public int dimension() { return dimension; }
83 /** See BasicType.java */
84 public int elementBasicType() { return elementBasicType; }
85 }
86
87 /** Only valid for T_ARRAY; throws unspecified exception otherwise */
88 public ArrayInfo getArrayInfo() {
89 int index = 1;
90 int dim = 1;
91 index = skipOptionalSize(signature, index);
|