|
|
@@ -22,6 +22,7 @@ import net.ranides.assira.collection.arrays.NativeArrayBuilder;
|
|
|
import net.ranides.assira.lexer.StringTokenizer;
|
|
|
import net.ranides.assira.reflection.IClass;
|
|
|
import net.ranides.assira.reflection.IContext;
|
|
|
+import net.ranides.assira.reflection.IExecutable;
|
|
|
import net.ranides.assira.reflection.IReflectiveException;
|
|
|
import net.ranides.assira.reflection.util.ClassUtils;
|
|
|
|
|
|
@@ -88,6 +89,29 @@ public final class FClass {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static IClass<?> newArgumentClass(IExecutable method, IContext context, Type itype, AnnotatedType atype) {
|
|
|
+ if(itype instanceof GenericArrayType) {
|
|
|
+ return FClass.newClass(context, (GenericArrayType) itype);
|
|
|
+ } else {
|
|
|
+ return CACHE.get(context, atype, () -> newArgumentClass0(method, context, itype, atype));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static RFClass<?> newArgumentClass0(IExecutable method, IContext context, Type itype, AnnotatedType atype) {
|
|
|
+ boolean isGenericMethodParam = method.params().stream().map(IClass::reflective).anyMatch(itype::equals);
|
|
|
+
|
|
|
+ if(!isGenericMethodParam) {
|
|
|
+ return new RFClass<>(context, context.typeinfo(itype), atype);
|
|
|
+ }
|
|
|
+
|
|
|
+ IClass<?> typeinfo = context.typeinfo(itype);
|
|
|
+ if(typeinfo instanceof RWClass<?>) {
|
|
|
+ typeinfo = ((RWClass<?>)typeinfo).swap();
|
|
|
+ }
|
|
|
+
|
|
|
+ return new RFClass<>(context, typeinfo, atype);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Creates IClass for provided annotated type, using context for type resolution.
|
|
|
*
|