il.append(fact.createInvoke("java/lang/Class","getDeclaredMethod",jlrMethod,new Type[]{jlString,jlClassArray},Constants.INVOKEVIRTUAL));
// FIXME asc perf Cache the result of getDeclaredMethod() and use it
// again for other annotations on the same signature at this join point
// Calls getAnnotation
String ss = toType.getName();
il.append(fact.createConstant(new ObjectType(toType.getName())));
il.append(fact.createInvoke("java/lang/reflect/Method","getAnnotation",jlaAnnotation,new Type[]{jlClass},Constants.INVOKEVIRTUAL));
il.append(Utility.createConversion(fact,jlaAnnotation,BcelWorld.makeBcelType(toType)));
} else { // init/preinit/ctor-call/ctor-exec
Type[] paramTypes = BcelWorld.makeBcelTypes(member.getParameterTypes());
buildArray(il,fact,jlClass,paramTypes,1);
Type jlrCtor = BcelWorld.makeBcelType(UnresolvedType.forSignature("Ljava.lang.reflect.Constructor;"));
il.append(fact.createInvoke("java/lang/Class","getDeclaredConstructor",jlrCtor,new Type[]{jlClassArray},Constants.INVOKEVIRTUAL));
// !!! OPTIMIZATION: Cache the result of getDeclaredMethod() and use it
// again for other annotations on the same signature at this join point
// Calls getAnnotation
String ss = toType.getName();
il.append(fact.createConstant(new ObjectType(toType.getName())));
il.append(fact.createInvoke("java/lang/reflect/Constructor","getAnnotation",jlaAnnotation,new Type[]{jlClass},Constants.INVOKEVIRTUAL));
il.append(Utility.createConversion(fact,jlaAnnotation,BcelWorld.makeBcelType(toType)));
}
} else if (kind == Shadow.FieldSet || kind == Shadow.FieldGet) {
Type jlrField = BcelWorld.makeBcelType(UnresolvedType.forSignature("Ljava.lang.reflect.Field;"));
il.append(fact.createConstant(BcelWorld.makeBcelType(containingType))); // Stick the target on the stack
il.append(fact.createConstant(member.getName())); // Stick what we are after on the stack
il.append(fact.createInvoke("java/lang/Class","getDeclaredField",jlrField,new Type[]{jlString},Constants.INVOKEVIRTUAL));
String ss = toType.getName();
il.append(fact.createConstant(new ObjectType(toType.getName())));
il.append(fact.createInvoke("java/lang/reflect/Field","getAnnotation",jlaAnnotation,new Type[]{jlClass},Constants.INVOKEVIRTUAL));
il.append(Utility.createConversion(fact,jlaAnnotation,BcelWorld.makeBcelType(toType)));
} else if (kind == Shadow.StaticInitialization || kind==Shadow.ExceptionHandler) {
il.append(fact.createConstant(BcelWorld.makeBcelType(containingType)));
String ss = toType.getName();
il.append(fact.createConstant(new ObjectType(toType.getName())));
il.append(fact.createInvoke("java/lang/Class","getAnnotation",jlaAnnotation,new Type[]{jlClass},Constants.INVOKEVIRTUAL));
il.append(Utility.createConversion(fact,jlaAnnotation,BcelWorld.makeBcelType(toType)));
} else {
throw new RuntimeException("Don't understand this kind "+kind);
}