public void Add(ClassFile classFile) { classFiles.Add(classFile); }
static FieldInfo FindJavaFieldProperty(KotlinFile kotlinClass, KotlinProperty property, ClassFile klass) { var possible_methods = klass.Fields.Where(field => field.Name == property.Name && TypesMatch(new TypeInfo(field.Descriptor, field.Descriptor), property.ReturnType, kotlinClass)); return(possible_methods.FirstOrDefault()); }
static MethodInfo FindJavaPropertySetter(KotlinFile kotlinClass, KotlinProperty property, ClassFile klass) { var possible_methods = klass.Methods.Where(method => string.Compare(method.GetMethodNameWithoutSuffix(), $"set{property.Name}", true) == 0 && property.ReturnType != null && method.GetParameters().Length == 1 && method.ReturnType.BinaryName == "V" && TypesMatch(method.GetParameters() [0].Type, property.ReturnType, kotlinClass)); return(possible_methods.FirstOrDefault()); }
static MethodInfo FindJavaMethod(KotlinFile kotlinFile, KotlinFunction function, ClassFile klass) { var possible_methods = klass.Methods.Where(method => method.Name == function.JvmName && method.GetFilteredParameters().Length == function.ValueParameters.Count); foreach (var method in possible_methods) { if (!TypesMatch(method.ReturnType, function.ReturnType, kotlinFile)) { continue; } if (!ParametersMatch(kotlinFile, method, function.ValueParameters)) { continue; } return(method); } return(null); }
static MethodInfo FindJavaConstructor(KotlinClass kotlinClass, KotlinConstructor constructor, ClassFile klass) { var all_constructors = klass.Methods.Where(method => method.Name == "<init>" || method.Name == "<clinit>"); var possible_constructors = all_constructors.Where(method => method.GetFilteredParameters().Length == constructor.ValueParameters.Count); foreach (var method in possible_constructors) { if (ParametersMatch(kotlinClass, method, constructor.ValueParameters)) { return(method); } } return(null); }
public bool ImplementsInterface(ClassFile classToCheck, ClassFile targetInteface) { return(classToCheck.GetInterfaces().Any(iface => targetInteface.ThisClass.Name.Value == iface.BinaryName)); }
IEnumerable <ClassFile> GetInterfaceImplemetations(ClassFile iface, IList <ClassFile> classFiles) { return(classFiles.Where(x => ImplementsInterface(x, iface))); }
static MethodInfo?FindJavaPropertyGetter(KotlinFile kotlinClass, KotlinProperty property, ClassFile klass) { var possible_methods = klass.Methods.Where(method => string.Compare(method.GetMethodNameWithoutSuffix(), $"get{property.Name}", StringComparison.OrdinalIgnoreCase) == 0 && method.GetParameters().Length == 0 && property.ReturnType != null && TypesMatch(method.ReturnType, property.ReturnType, kotlinClass)); return(possible_methods.FirstOrDefault()); }