105 |
unknownProtectionDomain = new ProtectionDomain(null, permissions); |
unknownProtectionDomain = new ProtectionDomain(null, permissions); |
106 |
} |
} |
107 |
|
|
108 |
private transient final VMClass vmClass; |
transient final VMClass vmClass; |
109 |
|
|
110 |
/** |
/** |
111 |
* Class is non-instantiable from Java code; only the VM can create |
* Class is non-instantiable from Java code; only the VM can create |
112 |
* instances of this class. |
* instances of this class. |
113 |
*/ |
*/ |
114 |
private Class() |
Class(VMClass vmClass) |
115 |
{ |
{ |
116 |
this.vmClass = VMClass.getInstance (); |
this.vmClass = vmClass; |
117 |
} |
} |
118 |
|
|
119 |
/** |
/** |
192 |
if (cl != null) |
if (cl != null) |
193 |
sm.checkPermission(new RuntimePermission("getClassLoader")); |
sm.checkPermission(new RuntimePermission("getClassLoader")); |
194 |
} |
} |
195 |
|
if (name.startsWith("[")) |
196 |
|
return VMClass.loadArrayClass(name, null); |
197 |
Class c = VMClassLoader.loadClass(name, initialize); |
Class c = VMClassLoader.loadClass(name, initialize); |
198 |
if (c != null) |
if (c != null) |
199 |
return c; |
{ |
200 |
|
if (initialize) |
201 |
|
c.vmClass.initialize(); |
202 |
|
return c; |
203 |
|
} |
204 |
throw new ClassNotFoundException(name); |
throw new ClassNotFoundException(name); |
205 |
} |
} |
206 |
return classloader.loadClass(name, initialize); |
if (name.startsWith("[")) |
207 |
|
return VMClass.loadArrayClass(name, classloader); |
208 |
|
Class c = classloader.loadClass(name, initialize); |
209 |
|
if (initialize) |
210 |
|
c.vmClass.initialize(); |
211 |
|
return c; |
212 |
} |
} |
213 |
|
|
214 |
/** |
/** |
306 |
if ((result = vmClass.isArray ()) < 0) |
if ((result = vmClass.isArray ()) < 0) |
307 |
return getName().charAt(0) == '['; |
return getName().charAt(0) == '['; |
308 |
|
|
309 |
return (result == 1) ? true : false; |
return result == 1; |
310 |
} |
} |
311 |
|
|
312 |
/** |
/** |
536 |
*/ |
*/ |
537 |
private Class[] internalGetClasses() { |
private Class[] internalGetClasses() { |
538 |
ArrayList list = new ArrayList(); |
ArrayList list = new ArrayList(); |
539 |
list.add(Arrays.asList(getDeclaredClasses(true))); |
list.addAll(Arrays.asList(getDeclaredClasses(true))); |
540 |
Class superClass = getSuperclass(); |
Class superClass = getSuperclass(); |
541 |
if (superClass != null) |
if (superClass != null) |
542 |
list.add(Arrays.asList(superClass.internalGetClasses())); |
list.addAll(Arrays.asList(superClass.internalGetClasses())); |
543 |
return (Class[])list.toArray(new Class[list.size()]); |
return (Class[])list.toArray(new Class[list.size()]); |
544 |
} |
} |
545 |
|
|
565 |
*/ |
*/ |
566 |
private Field[] internalGetFields() { |
private Field[] internalGetFields() { |
567 |
ArrayList list = new ArrayList(); |
ArrayList list = new ArrayList(); |
568 |
list.add(Arrays.asList(getDeclaredFields(true))); |
list.addAll(Arrays.asList(getDeclaredFields(true))); |
569 |
if (isInterface()) { |
if (isInterface()) { |
570 |
Class[] interfaces = getInterfaces(); |
Class[] interfaces = getInterfaces(); |
571 |
for (int i = 0; i < interfaces.length; i++) |
for (int i = 0; i < interfaces.length; i++) |
572 |
list.add(Arrays.asList(interfaces[i].internalGetFields())); |
list.addAll(Arrays.asList(interfaces[i].internalGetFields())); |
573 |
} else { |
} else { |
574 |
Class superClass = getSuperclass(); |
Class superClass = getSuperclass(); |
575 |
if (superClass != null) |
if (superClass != null) |
576 |
list.add(Arrays.asList(superClass.internalGetFields())); |
list.addAll(Arrays.asList(superClass.internalGetFields())); |
577 |
} |
} |
578 |
return (Field[])list.toArray(new Field[list.size()]); |
return (Field[])list.toArray(new Field[list.size()]); |
579 |
} |
} |
757 |
throws NoSuchMethodException { |
throws NoSuchMethodException { |
758 |
memberAccessCheck(Member.PUBLIC); |
memberAccessCheck(Member.PUBLIC); |
759 |
for (Class c = this; c != null; c = c.getSuperclass()) { |
for (Class c = this; c != null; c = c.getSuperclass()) { |
760 |
Method match = matchMethod(c.getDeclaredMethods(true), name, args); |
Method match = matchMethod(c.getDeclaredMethods(true), name, args); |
761 |
if (match != null) |
if (match != null) |
762 |
return match; |
return match; |
763 |
|
Class[] interfaces = c.getInterfaces(); |
764 |
|
for (int i = 0; i < interfaces.length; i++) |
765 |
|
{ |
766 |
|
match = matchMethod(interfaces[i].getDeclaredMethods(true), name, args); |
767 |
|
if (match != null) |
768 |
|
return match; |
769 |
|
} |
770 |
} |
} |
771 |
throw new NoSuchMethodException(); |
throw new NoSuchMethodException(); |
772 |
} |
} |