77 }
78
79 public List<Method> allMethods() {
80 return new ArrayList<>(0); // arrays don't have methods
81 }
82
83 /*
84 * Find the type object, if any, of a component type of this array.
85 * The component type does not have to be immediate; e.g. this method
86 * can be used to find the component Foo of Foo[][]. This method takes
87 * advantage of the property that an array and its component must have
88 * the same class loader. Since array set operations don't have an
89 * implicit enclosing type like field and variable set operations,
90 * this method is sometimes needed for proper type checking.
91 */
92 Type findComponentType(String signature) throws ClassNotLoadedException {
93 byte tag = (byte)signature.charAt(0);
94 if (PacketStream.isObjectTag(tag)) {
95 // It's a reference type
96 JNITypeParser parser = new JNITypeParser(componentSignature());
97 List<ReferenceType> list = vm.classesByName(parser.typeName());
98 Iterator<ReferenceType> iter = list.iterator();
99 while (iter.hasNext()) {
100 ReferenceType type = iter.next();
101 ClassLoaderReference cl = type.classLoader();
102 if ((cl == null)?
103 (classLoader() == null) :
104 (cl.equals(classLoader()))) {
105 return type;
106 }
107 }
108 // Component class has not yet been loaded
109 throw new ClassNotLoadedException(componentTypeName());
110 } else {
111 // It's a primitive type
112 return vm.primitiveTypeMirror(tag);
113 }
114 }
115
116 public Type componentType() throws ClassNotLoadedException {
117 return findComponentType(componentSignature());
|
77 }
78
79 public List<Method> allMethods() {
80 return new ArrayList<>(0); // arrays don't have methods
81 }
82
83 /*
84 * Find the type object, if any, of a component type of this array.
85 * The component type does not have to be immediate; e.g. this method
86 * can be used to find the component Foo of Foo[][]. This method takes
87 * advantage of the property that an array and its component must have
88 * the same class loader. Since array set operations don't have an
89 * implicit enclosing type like field and variable set operations,
90 * this method is sometimes needed for proper type checking.
91 */
92 Type findComponentType(String signature) throws ClassNotLoadedException {
93 byte tag = (byte)signature.charAt(0);
94 if (PacketStream.isObjectTag(tag)) {
95 // It's a reference type
96 JNITypeParser parser = new JNITypeParser(componentSignature());
97 List<ReferenceType> list = vm.classesBySignature(componentSignature());
98 Iterator<ReferenceType> iter = list.iterator();
99 while (iter.hasNext()) {
100 ReferenceType type = iter.next();
101 ClassLoaderReference cl = type.classLoader();
102 if ((cl == null)?
103 (classLoader() == null) :
104 (cl.equals(classLoader()))) {
105 return type;
106 }
107 }
108 // Component class has not yet been loaded
109 throw new ClassNotLoadedException(componentTypeName());
110 } else {
111 // It's a primitive type
112 return vm.primitiveTypeMirror(tag);
113 }
114 }
115
116 public Type componentType() throws ClassNotLoadedException {
117 return findComponentType(componentSignature());
|