You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2008/05/26 21:26:33 UTC
svn commit: r660276 -
/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
Author: ndbeyer
Date: Mon May 26 12:26:31 2008
New Revision: 660276
URL: http://svn.apache.org/viewvc?rev=660276&view=rev
Log:
Clean up doc
Eliminate unchecked cast warnings
Rearrange members so that static items are together at the top and fields are before methods
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java?rev=660276&r1=660275&r2=660276&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java Mon May 26 12:26:31 2008
@@ -58,68 +58,30 @@
import org.apache.harmony.vm.VMStack;
/**
- * @com.intel.drl.spec_ref
+ * Runtime representation of a class
*
* @author Evgueni Brevnov, Serguei S. Zapreyev, Alexey V. Varlamov
* @version $Revision: 1.1.2.2.4.5 $
*/
-//public final class Class implements Serializable {
-
public final class Class<T> implements Serializable, AnnotatedElement, GenericDeclaration, Type {
- private static final long serialVersionUID = 3206093459760846163L;
-
- static ProtectionDomain systemDomain;
-
- private transient ProtectionDomain domain;
-
- /** It is required for synchronization in newInstance method. */
- private boolean isDefaultConstructorInitialized;
-
- // TODO make it soft reference
- transient ReflectionData reflectionData;
- transient SoftReference<GACache> softCache;
-
- /**
- * Indicates whether the following properties have been calculated;
- * isSerializable, isExternalizable, isPrimitive
+ /**
+ * Assertion status of this class
*
- * @see #resolveProperties()
+ * package private to access from the java.lang.ClassLoader class.
*/
- private transient volatile boolean arePropertiesResolved;
+ static volatile boolean disableAssertions =
+ VMExecutionEngine.getAssertionStatus(null, false, 0) <= 0;
- private transient boolean isSerializable;
- private transient boolean isExternalizable;
- private transient boolean isPrimitive;
+ static ProtectionDomain systemDomain;
- private GACache getCache() {
- GACache cache = null;
- if (softCache != null) {
- cache = softCache.get();
- }
- if (cache == null) {
- softCache = new SoftReference<GACache>(cache = new GACache());
- }
- return cache;
- }
-
- /**
- * Only VM can instantiate this class.
- */
- private Class() {
- }
+ private static final long serialVersionUID = 3206093459760846163L;
- /**
- * @com.intel.drl.spec_ref
- */
public static Class<?> forName(String name) throws ClassNotFoundException {
return forName(name, true, VMClassRegistry.getClassLoader(VMStack
.getCallerClass(0)));
}
- /**
- * @com.intel.drl.spec_ref
- */
public static Class<?> forName(String name, boolean initialize,
ClassLoader classLoader) throws ClassNotFoundException {
if (name == null) {
@@ -129,7 +91,7 @@
throw new ClassNotFoundException(name);
}
- Class clazz = null;
+ Class<?> clazz = null;
if (classLoader == null) {
SecurityManager sc = System.getSecurityManager();
@@ -163,11 +125,13 @@
throw new ClassNotFoundException(name);
}
if(classLoader != null) {
- // Although class loader may have had a chance to register
- // itself as initiating for requested class, there may occur
- // a classloader which overloads loadClass method (though it is
- // not recommended by J2SE specification).
- // Try to register initiating loader for clazz from here again
+ /*
+ * Although class loader may have had a chance to register itself as
+ * initiating for requested class, there may occur a classloader
+ * which overloads loadClass method (though it is not recommended by
+ * J2SE specification). Try to register initiating loader for clazz
+ * from here again
+ */
classLoader.registerInitiatedClass(clazz);
}
if (initialize) {
@@ -177,16 +141,125 @@
}
return clazz;
}
+
+ /**
+ * VMI method
+ */
+ static final Class<?>[] getStackClasses(int maxDepth, boolean stopAtPrivileged) {
+ return VMStack.getClasses(maxDepth, stopAtPrivileged);
+ }
+
+ /**
+ * Answers whether the arrays are equal
+ */
+ static boolean isTypeMatches(Class<?>[] t1, Class<?>[] t2) {
+ if (t1 == null) {
+ return t2 == null || t2.length == 0;
+ }
+ if (t2 == null) {
+ return t1 == null || t1.length == 0;
+ }
+ if (t1.length != t2.length) {
+ return false;
+ }
+ for (int i = 0; i < t2.length; i++) {
+ if (t1[i] != t2[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static Method findMatchingMethod(Method[] methods,
+ String methodName, Class<?>[] argumentTypes)
+ throws NoSuchMethodException {
+ Method matcher = null;
+ for (int i = 0; i < methods.length; i++) {
+ Method m = methods[i];
+ if (matcher != null
+ && matcher.getDeclaringClass() != m.getDeclaringClass()) {
+ return matcher;
+ }
+ try {
+ if (methodName.equals(m.getName())
+ && isTypeMatches(argumentTypes, m.getParameterTypes())
+ && (matcher == null || matcher.getReturnType()
+ .isAssignableFrom(m.getReturnType()))) {
+ matcher = m;
+ }
+ } catch (LinkageError ignore) {
+ }
+ }
+ if (matcher == null) {
+ throw new NoSuchMethodException(methodName.toString()
+ + printMethodSignature(argumentTypes));
+ }
+ return matcher;
+ }
+
+ private static String getParentName(String name) {
+ int dotPosition = name.lastIndexOf('.');
+ return dotPosition == -1 ? "" : name.substring(0, dotPosition);
+ }
+
+ private static String printMethodSignature(Class<?>[] types) {
+ StringBuffer sb = new StringBuffer("(");
+ if (types != null && types.length > 0) {
+ sb.append(types[0] != null ? types[0].getName() : "null");
+ for (int i = 1; i < types.length; i++) {
+ sb.append(", ");
+ sb.append(types[i] != null ? types[i].getName() : "null");
+ }
+ }
+ sb.append(")");
+ return sb.toString();
+ }
/**
- * package private to access from the java.lang.ClassLoader class.
+ * Provides strong referencing between the classloader
+ * and it's defined classes. Intended for class unloading implementation.
+ * @see java.lang.ClassLoader#loadedClasses
*/
- static volatile boolean disableAssertions =
- VMExecutionEngine.getAssertionStatus(null, false, 0) <= 0;
+ ClassLoader definingLoader;
+
+ // TODO make it soft reference
+ transient ReflectionData reflectionData;
+ transient SoftReference<GACache> softCache;
+
+ private transient ProtectionDomain domain;
+
+ /** It is required for synchronization in newInstance method. */
+ private boolean isDefaultConstructorInitialized;
+
+ /**
+ * Indicates whether the following properties have been calculated;
+ * isSerializable, isExternalizable, isPrimitive
+ *
+ * @see #resolveProperties()
+ */
+ private transient volatile boolean arePropertiesResolved;
+
+ private transient boolean isSerializable;
+ private transient boolean isExternalizable;
+ private transient boolean isPrimitive;
/**
- * @com.intel.drl.spec_ref
+ * Only VM can instantiate this class.
*/
+ private Class() {
+ }
+
+ private GACache getCache() {
+ GACache cache = null;
+ if (softCache != null) {
+ cache = softCache.get();
+ }
+ if (cache == null) {
+ softCache = new SoftReference<GACache>(cache = new GACache());
+ }
+ return cache;
+ }
+
public boolean desiredAssertionStatus() {
if (disableAssertions) {
return false;
@@ -245,25 +318,23 @@
}
/**
- * @com.intel.drl.spec_ref
- *
* Note: We don't check member access permission for each super class.
* Java 1.5 API specification doesn't require this check.
*/
- public Class[] getClasses() {
+ public Class<?>[] getClasses() {
if (reflectionData == null) {
initReflectionData();
}
checkMemberAccess(Member.PUBLIC);
- Class clss = this;
- ArrayList<Class> classes = null;
+ Class<?> clss = this;
+ ArrayList<Class<?>> classes = null;
while (clss != null) {
- Class[] declared = VMClassRegistry.getDeclaredClasses(clss);
+ Class<?>[] declared = VMClassRegistry.getDeclaredClasses(clss);
if (declared.length != 0) {
if (classes == null) {
- classes = new ArrayList<Class>();
+ classes = new ArrayList<Class<?>>();
}
- for (Class c : declared) {
+ for (Class<?> c : declared) {
if (Modifier.isPublic(c.getModifiers())) {
classes.add(c);
}
@@ -278,9 +349,6 @@
}
}
- /**
- * @com.intel.drl.spec_ref
- */
public ClassLoader getClassLoader() {
ClassLoader loader = getClassLoaderImpl();
SecurityManager sc = System.getSecurityManager();
@@ -294,18 +362,14 @@
return loader;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Class<?> getComponentType() {
- if(!isArray()) return null;
+ if (!isArray()) {
+ return null;
+ }
return VMClassRegistry.getComponentType(this);
}
- /**
- * @com.intel.drl.spec_ref
- */
- public Constructor<T> getConstructor(Class... argumentTypes)
+ public Constructor<T> getConstructor(Class<?>... argumentTypes)
throws NoSuchMethodException {
if (reflectionData == null) {
initReflectionData();
@@ -322,12 +386,9 @@
}
throw new NoSuchMethodException(getName()
+ printMethodSignature(argumentTypes));
-
}
- /**
- * @com.intel.drl.spec_ref
- */
+ @SuppressWarnings("unchecked")
public Constructor[] getConstructors() {
if (reflectionData == null) {
initReflectionData();
@@ -336,9 +397,7 @@
return Reflection.copyConstructors(reflectionData.getPublicConstructors());
}
- /**
- * @com.intel.drl.spec_ref
- */
+ @SuppressWarnings("unchecked")
public Class[] getDeclaredClasses() {
if (reflectionData == null) {
initReflectionData();
@@ -347,9 +406,7 @@
return VMClassRegistry.getDeclaredClasses(this);
}
- /**
- * @com.intel.drl.spec_ref
- */
+ @SuppressWarnings("unchecked")
public Constructor<T> getDeclaredConstructor(Class... argumentTypes)
throws NoSuchMethodException {
if (reflectionData == null) {
@@ -360,9 +417,7 @@
.copyConstructor(getDeclaredConstructorInternal(argumentTypes));
}
- /**
- * @com.intel.drl.spec_ref
- */
+ @SuppressWarnings("unchecked")
public Constructor[] getDeclaredConstructors() {
if (reflectionData == null) {
initReflectionData();
@@ -374,9 +429,6 @@
return Reflection.copyConstructors(reflectionData.declaredConstructors);
}
- /**
- * @com.intel.drl.spec_ref
- */
public Field getDeclaredField(String fieldName) throws NoSuchFieldException {
if (reflectionData == null) {
initReflectionData();
@@ -394,9 +446,6 @@
throw new NoSuchFieldException(fieldName.toString());
}
- /**
- * @com.intel.drl.spec_ref
- */
public Field[] getDeclaredFields() {
if (reflectionData == null) {
initReflectionData();
@@ -408,9 +457,7 @@
return Reflection.copyFields(reflectionData.declaredFields);
}
- /**
- * @com.intel.drl.spec_ref
- */
+ @SuppressWarnings("unchecked")
public Method getDeclaredMethod(String methodName, Class... argumentTypes)
throws NoSuchMethodException {
if (reflectionData == null) {
@@ -425,9 +472,6 @@
methodName, argumentTypes));
}
- /**
- * @com.intel.drl.spec_ref
- */
public Method[] getDeclaredMethods() {
if (reflectionData == null) {
initReflectionData();
@@ -439,16 +483,10 @@
return Reflection.copyMethods(reflectionData.declaredMethods);
}
- /**
- * @com.intel.drl.spec_ref
- */
public Class<?> getDeclaringClass() {
return VMClassRegistry.getDeclaringClass(this);
}
- /**
- * @com.intel.drl.spec_ref
- */
public Field getField(String fieldName) throws NoSuchFieldException {
if (reflectionData == null) {
initReflectionData();
@@ -463,9 +501,6 @@
throw new NoSuchFieldException(fieldName.toString());
}
- /**
- * @com.intel.drl.spec_ref
- */
public Field[] getFields() {
if (reflectionData == null) {
initReflectionData();
@@ -474,16 +509,12 @@
return Reflection.copyFields(reflectionData.getPublicFields());
}
- /**
- * @com.intel.drl.spec_ref
- */
+ @SuppressWarnings("unchecked")
public Class[] getInterfaces() {
return VMClassRegistry.getInterfaces(this);
}
- /**
- * @com.intel.drl.spec_ref
- */
+ @SuppressWarnings("unchecked")
public Method getMethod(String methodName, Class... argumentTypes)
throws NoSuchMethodException {
if (reflectionData == null) {
@@ -495,9 +526,6 @@
methodName, argumentTypes));
}
- /**
- * @com.intel.drl.spec_ref
- */
public Method[] getMethods() {
if (reflectionData == null) {
initReflectionData();
@@ -506,9 +534,6 @@
return Reflection.copyMethods(reflectionData.getPublicMethods());
}
- /**
- * @com.intel.drl.spec_ref
- */
public int getModifiers() {
if (reflectionData == null) {
initReflectionData();
@@ -520,9 +545,6 @@
return mods;
}
- /**
- * @com.intel.drl.spec_ref
- */
public String getName() {
if (reflectionData == null) {
initReflectionData();
@@ -530,9 +552,6 @@
return reflectionData.name;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Package getPackage() {
ClassLoader classLoader = getClassLoaderImpl();
return classLoader == null
@@ -540,28 +559,23 @@
: classLoader.getPackage(getPackageName());
}
- /**
- * @com.intel.drl.spec_ref
- */
public ProtectionDomain getProtectionDomain() {
SecurityManager sc = System.getSecurityManager();
if (sc != null) {
- sc.checkPermission(RuntimePermissionCollection.GET_PROTECTION_DOMAIN_PERMISSION);
+ sc.checkPermission(
+ RuntimePermissionCollection.GET_PROTECTION_DOMAIN_PERMISSION);
}
if (domain == null) {
- if (systemDomain == null) {
- Permissions allPermissions = new Permissions();
- allPermissions.add(new AllPermission());
- systemDomain = new ProtectionDomain(null, allPermissions);
- }
- return systemDomain;
+ if (systemDomain == null) {
+ Permissions allPermissions = new Permissions();
+ allPermissions.add(new AllPermission());
+ systemDomain = new ProtectionDomain(null, allPermissions);
+ }
+ return systemDomain;
}
return domain;
}
- /**
- * @com.intel.drl.spec_ref
- */
public URL getResource(String resource) {
resource = getAbsoluteResource(resource);
ClassLoader classLoader = getClassLoaderImpl();
@@ -570,9 +584,6 @@
: classLoader.getResource(resource);
}
- /**
- * @com.intel.drl.spec_ref
- */
public InputStream getResourceAsStream(String resource) {
resource = getAbsoluteResource(resource);
ClassLoader classLoader = getClassLoaderImpl();
@@ -581,9 +592,6 @@
: classLoader.getResourceAsStream(resource);
}
- /**
- * @com.intel.drl.spec_ref
- */
public Object[] getSigners() {
try {
Object[] signers = (Object[])getClassLoaderImpl().classSigners.get(getName());
@@ -597,16 +605,10 @@
return null;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Class<? super T> getSuperclass() {
return VMClassRegistry.getSuperclass(this);
}
- /**
- * @com.intel.drl.spec_ref
- */
public boolean isArray() {
if (reflectionData == null) {
initReflectionData();
@@ -624,9 +626,6 @@
arePropertiesResolved = true;
}
- /**
- * @com.intel.drl.spec_ref
- */
public boolean isAssignableFrom(Class<?> clazz) {
if (Serializable.class.equals(this)) {
@@ -644,34 +643,22 @@
return VMClassRegistry.isAssignableFrom(this, clazz);
}
- /**
- * @com.intel.drl.spec_ref
- */
public boolean isInstance(Object obj) {
return VMClassRegistry.isInstance(this, obj);
}
- /**
- * @com.intel.drl.spec_ref
- */
public boolean isInterface() {
return (getModifiers() & ACC_INTERFACE) != 0;
}
- /**
- * @com.intel.drl.spec_ref
- */
public boolean isPrimitive() {
// assure that props have been resolved
resolveProperties();
return isPrimitive;
}
- /**
- * @com.intel.drl.spec_ref
- */
public T newInstance() throws InstantiationException,
- IllegalAccessException {
+ IllegalAccessException {
T newInstance = null;
if (reflectionData == null) {
initReflectionData();
@@ -716,7 +703,7 @@
}
});
} catch (SecurityException e) {
- // can't change accessibilty of the default constructor
+ // can't change accessibility of the default constructor
IllegalAccessException ex = new IllegalAccessException();
ex.initCause(e);
throw ex;
@@ -744,39 +731,11 @@
return newInstance;
}
- /**
- * @com.intel.drl.spec_ref
- */
public String toString() {
return isPrimitive() ? getName()
: (isInterface() ? "interface " : "class ") + getName();
}
- /*
- * NON API SECTION
- */
-
- /**
- * Answers whether the arrays are equal
- */
- static boolean isTypeMatches(Class[] t1, Class[] t2) {
- if (t1 == null) {
- return t2 == null || t2.length == 0;
- }
- if (t2 == null) {
- return t1 == null || t1.length == 0;
- }
- if (t1.length != t2.length) {
- return false;
- }
- for (int i = 0; i < t2.length; i++) {
- if (t1[i] != t2[i]) {
- return false;
- }
- }
- return true;
- }
-
/**
* This is not time consume operation so we can do syncrhronization on this
* class object. Note, this method has package private visibility in order
@@ -800,50 +759,6 @@
domain = protectionDomain;
}
- static private Method findMatchingMethod(Method[] methods, String methodName,
- Class[] argumentTypes)
- throws NoSuchMethodException {
- Method matcher = null;
- for (int i = 0; i < methods.length; i++) {
- Method m = methods[i];
- if (matcher != null && matcher.getDeclaringClass() != m
- .getDeclaringClass()) {
- return matcher;
- }
- try {
- if (methodName.equals(m.getName())
- && isTypeMatches(argumentTypes, m.getParameterTypes())
- && (matcher == null || matcher.getReturnType()
- .isAssignableFrom(m.getReturnType()))) {
- matcher = m;
- }
- } catch (LinkageError ignore) {}
- }
- if (matcher == null) {
- throw new NoSuchMethodException(methodName.toString()
- + printMethodSignature(argumentTypes));
- }
- return matcher;
- }
-
- static private String getParentName(String name) {
- int dotPosition = name.lastIndexOf('.');
- return dotPosition == -1 ? "" : name.substring(0, dotPosition);
- }
-
- static private String printMethodSignature(Class[] types) {
- StringBuffer sb = new StringBuffer("(");
- if (types != null && types.length > 0) {
- sb.append(types[0] != null ? types[0].getName() : "null");
- for (int i = 1; i < types.length; i++) {
- sb.append(", ");
- sb.append(types[i] != null ? types[i].getName() : "null");
- }
- }
- sb.append(")");
- return sb.toString();
- }
-
private void checkMemberAccess(int accessType) {
SecurityManager sc = System.getSecurityManager();
if (sc != null) {
@@ -863,7 +778,7 @@
return resource;
}
- private Constructor<T> getDeclaredConstructorInternal(Class[] argumentTypes)
+ private Constructor<T> getDeclaredConstructorInternal(Class<?>[] argumentTypes)
throws NoSuchMethodException {
if (reflectionData.declaredConstructors == null) {
reflectionData.initDeclaredConstructors();
@@ -879,31 +794,19 @@
}
private String getTopLevelClassName() {
- Class declaringClass = getDeclaringClass();
+ Class<?> declaringClass = getDeclaringClass();
return declaringClass == null
? getName() : declaringClass.getTopLevelClassName();
}
-
- /* VMI SPECIFIC PART*/
-
+ /**
+ * VMI method
+ */
final ClassLoader getClassLoaderImpl() {
assert(VMClassRegistry.getClassLoader0(this) == definingLoader);
return definingLoader;
}
- static final Class[] getStackClasses(int maxDepth,
- boolean stopAtPrivileged) {
- return VMStack.getClasses(maxDepth, stopAtPrivileged);
- }
-
- /* END OF VMI SPECIFIC PART */
-
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public Annotation[] getDeclaredAnnotations() {
Annotation[] declared = getCache().getDeclaredAnnotations();
Annotation aa[] = new Annotation[declared.length];
@@ -911,11 +814,6 @@
return aa;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public Annotation[] getAnnotations() {
Annotation[] all = getCache().getAllAnnotations();
Annotation aa[] = new Annotation[all.length];
@@ -923,11 +821,6 @@
return aa;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
@SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
if(annotationClass == null) {
@@ -941,11 +834,6 @@
return null;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
if(annotationClass == null) {
throw new NullPointerException();
@@ -958,11 +846,6 @@
return false;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
@SuppressWarnings("unchecked")
public T[] getEnumConstants() {
if (isEnum()) {
@@ -980,31 +863,16 @@
return null;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public boolean isEnum() {
// check for superclass is needed for compatibility
// otherwise there are false positives on anonymous element classes
return ((getModifiers() & ACC_ENUM) != 0 && getSuperclass() == Enum.class);
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public boolean isAnnotation() {
return (getModifiers() & ACC_ANNOTATION) != 0;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
@SuppressWarnings("unchecked")
public <U> Class<? extends U> asSubclass(Class<U> clazz) throws ClassCastException {
if (!VMClassRegistry.isAssignableFrom(clazz, this)) {
@@ -1014,11 +882,6 @@
return (Class<? extends U>)this;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
@SuppressWarnings("unchecked")
public T cast(Object obj) throws ClassCastException {
if (obj != null && !VMClassRegistry.isInstance(this, obj)) {
@@ -1027,40 +890,20 @@
return (T) obj;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public TypeVariable<Class<T>>[] getTypeParameters() throws GenericSignatureFormatError {
return (TypeVariable<Class<T>>[])getCache().getTypeParameters().clone();
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public Method getEnclosingMethod() {
Member m = VMClassRegistry.getEnclosingMember(this); // see VMClassRegistry.getEnclosingMember() spec
return m instanceof Method? (Method)m : null;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public Constructor<?> getEnclosingConstructor() {
Member m = VMClassRegistry.getEnclosingMember(this); // see VMClassRegistry.getEnclosingMember() spec
return m instanceof Constructor ? (Constructor<?>)m : null;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public Type[] getGenericInterfaces() throws GenericSignatureFormatError, TypeNotPresentException, MalformedParameterizedTypeException {
if (isArray()) {
return new Type[]{Cloneable.class, Serializable.class};
@@ -1072,11 +915,6 @@
return (Type[])getCache().getGenericInterfaces().clone();
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public Type getGenericSuperclass() throws GenericSignatureFormatError, TypeNotPresentException, MalformedParameterizedTypeException {
String tmp;
if (isInterface() || ((tmp = getCanonicalName()) != null && tmp.equals("java.lang.Object")) || isPrimitive()) {
@@ -1086,7 +924,7 @@
return (Type) Object.class;
}
- Class clazz = getSuperclass();
+ Class<?> clazz = getSuperclass();
if (clazz.getTypeParameters().length == 0) {
return (Type) clazz;
}
@@ -1094,56 +932,27 @@
return getCache().getGenericSuperclass();
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public Class<?> getEnclosingClass() {
return VMClassRegistry.getEnclosingClass(this); // see VMClassRegistry.getEnclosingClass() spec
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public boolean isMemberClass() {
return getDeclaringClass() != null; // see Class.getDeclaringClass() spec
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public boolean isLocalClass() {
return VMClassRegistry.getEnclosingMember(this) != null && !isAnonymousClass(); // see CFF spec, #4.8.6, first paragraph and VMClassRegistry.getEnclosingMember() spec
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
+
public boolean isAnonymousClass() {
return getSimpleName().length() == 0;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public boolean isSynthetic() {
return (getModifiers() & ACC_SYNTHETIC) != 0;
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public String getCanonicalName() {
if (isLocalClass() || isAnonymousClass()) {
return null;
@@ -1155,7 +964,7 @@
StringBuffer sb = new StringBuffer(getPackageName());
ArrayList<String> sympleNames = new ArrayList<String>();
- Class clss = this;
+ Class<?> clss = this;
while ((clss = clss.getDeclaringClass()) != null) {
if (clss.isLocalClass() || clss.isAnonymousClass()) {
return null;
@@ -1173,23 +982,10 @@
return sb.toString();
}
- /**
- *
- * @com.intel.drl.spec_ref
- *
- **/
public String getSimpleName() {
-// TODO: the method result should be reusible
return VMClassRegistry.getSimpleName(this);
}
- /**
- * Provides strong referencing between the classloader
- * and it's defined classes. Intended for class unloading implementation.
- * @see java.lang.ClassLoader#loadedClasses
- */
- ClassLoader definingLoader;
-
private final class ReflectionData {
String name;
@@ -1283,7 +1079,7 @@
// initialize public fields of the super class
int size = declaredFields.length;
- Class superClass = Class.this.getSuperclass();
+ Class<?> superClass = Class.this.getSuperclass();
Field[] superFields = null;
if (superClass != null) {
if (superClass.reflectionData == null) {
@@ -1302,8 +1098,8 @@
}
// initialize and add fields of the super interfaces
- Class[] interfaces = Class.this.getInterfaces();
- for (Class ci : interfaces) {
+ Class<?>[] interfaces = Class.this.getInterfaces();
+ for (Class<?> ci : interfaces) {
if (ci.reflectionData == null) {
ci.initReflectionData();
}
@@ -1337,7 +1133,7 @@
// initialize public methods of the super class
int size = declaredMethods.length;
- Class superClass = Class.this.getSuperclass();
+ Class<?> superClass = Class.this.getSuperclass();
Method[] superPublic = null;
if (superClass != null) {
if (superClass.reflectionData == null) {
@@ -1348,12 +1144,12 @@
}
// add methods of the super interfaces
- Class[] interfaces = Class.this.getInterfaces();
+ Class<?>[] interfaces = Class.this.getInterfaces();
Method[][] intf = null;
if (interfaces.length != 0) {
intf = new Method[interfaces.length][];
for (int i = 0; i < interfaces.length; i++) {
- Class ci = interfaces[i];
+ Class<?> ci = interfaces[i];
if (ci.reflectionData == null) {
ci.initReflectionData();
}
@@ -1385,7 +1181,7 @@
}
// look for inherited annotations
- Class superClass = Class.this.getSuperclass();
+ Class<?> superClass = Class.this.getSuperclass();
if (superClass != null) {
Annotation[] sa = superClass.getCache().getAllAnnotations();
if (sa.length != 0) {