// TODO: Fix for Groovy's model-checking
public native TypeVariable<Class<T>>[] getTypeParameters();
- public Type getGenericSuperclass() {
+ public native Type getGenericSuperclass();
+ /*public Type getGenericSuperclass() {
throw new UnsupportedOperationException();
- }
-
- public Type[] getGenericInterfaces() {
+ }*/
+
+ public native Type[] getGenericInterfaces();
+ /*public Type[] getGenericInterfaces() {
throw new UnsupportedOperationException();
- }
+ }*/
public Object[] getSigners() {
throw new UnsupportedOperationException();
}
// TODO: Fix for Groovy's model-checking
+ @MJI
+ public int getGenericSuperclass____Ljava_lang_reflect_Type_2 (MJIEnv env, int robj){
+ // TODO: Need to add ParameterizedTypeImpl
+ ClassInfo ci = env.getReferredClassInfo( robj);
+ ClassInfo sci = ci.getSuperClass();
+ if (sci != null) {
+ return sci.getClassObjectRef();
+ } else {
+ return MJIEnv.NULL;
+ }
+ }
+
+ @MJI
+ public int getGenericInterfaces_____3Ljava_lang_reflect_Type_2 (MJIEnv env, int robj) {
+ // TODO: Need to add ParameterizedTypeImpl
+ ClassInfo ci = env.getReferredClassInfo(robj);
+ int aref = MJIEnv.NULL;
+ ThreadInfo ti = env.getThreadInfo();
+
+ // contrary to the API doc, this only returns the interfaces directly
+ // implemented by this class, not it's bases
+ // <2do> this is not exactly correct, since the interfaces should be ordered
+ Set<ClassInfo> interfaces = ci.getInterfaceClassInfos();
+ aref = env.newObjectArray("Ljava/lang/Class;", interfaces.size());
+
+ int i=0;
+ for (ClassInfo ifc: interfaces){
+ env.setReferenceArrayElement(aref, i++, ifc.getClassObjectRef());
+ }
+
+ return aref;
+ }
+
@MJI
public int getTypeParameters_____3Ljava_lang_reflect_TypeVariable_2 (MJIEnv env, int robj){
// Get the ClassInfo for this class