}
System.out.println();*/
TypeVariable[] typeParameters = Generic.class.getTypeParameters();
- System.out.println("Members: " + typeParameters.length);
//TypeVariable[] typeParameters = SampleClass.class.getTypeParameters();
for(TypeVariable typeVar: typeParameters){
System.out.println(typeVar);
*/
public class TypeVariableImpl<D extends GenericDeclaration>
extends LazyReflectiveObjectGenerator implements TypeVariable<D> {
+//public class TypeVariableImpl {
D genericDeclaration;
private String name;
private Type[] bounds;
private FieldTypeSignature[] boundASTs;
- private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
+ //private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
// constructor is private to enforce access through static factory
private TypeVariableImpl(D decl, String n, FieldTypeSignature[] bs,
GenericsFactory f) {
if (!((decl instanceof Class) ||
- (decl instanceof Method) ||
+ //(decl instanceof Method) ||
(decl instanceof Constructor))) {
throw new AssertionError("Unexpected kind of GenericDeclaration" +
decl.getClass().toString());
return ((data[idx++]&0xff) << 8) | (data[idx]&0xff);
}
+ // TODO: DIRTY HACKS!!!
+ public final int readU4(){
+ int idx = pos;
+ pos += 4;
+ byte[] data = this.data;
+
+ return ((data[idx++]&0xff) <<24) | ((data[idx++]&0xff) << 16) | ((data[idx++]&0xff) << 8) | (data[idx]&0xff);
+ }
+
public final int readI2() {
int idx = pos;
pos += 2;
@MJI
public int getTypeParameters_____3Ljava_lang_reflect_TypeVariable_2 (MJIEnv env, int robj){
ClassLoaderInfo cli = env.getSystemClassLoaderInfo();
- ClassInfo rci = cli.getResolvedClassInfo("sun.reflect.generics.reflectiveObjects.TypeVariableImpl");
+ ClassInfo ci = cli.getResolvedClassInfo("sun.reflect.generics.reflectiveObjects.TypeVariableImpl");
+ //ClassInfo rci = cli.getResolvedClassInfo("sun.reflect.generics.reflectiveObjects.Test");
// TODO: Need to 1) Just create the object of TypeVariableImpl, 2) Declare class type and name only, 3) Return the
// object reference back to the caller
- ClassInfo test = cli.getResolvedClassInfo("java.lang.Class");
+ int tvRef = env.newObject(ci);
+ ElementInfo ei = env.getModifiableElementInfo(tvRef);
+
ClassInfo tci = env.getReferredClassInfo( robj);
- int ei = env.newObject(test);
+ //ei.setReferenceField("genericDeclaration", env.newObject(tci.getName() + ".class"));
+ ei.setReferenceField("name", env.newString("TUVW"));
+ int aRef = env.newObjectArray("Ljava/lang/reflect/TypeVariable;", 1);
+ for (int i = 0; i < 1; i++) {
+ env.setReferenceArrayElement(aRef, i, tvRef);
+ }
- return MJIEnv.NULL;
+ return aRef;
}
@MJI