public override void Resolve(JavaTypeCollection types, ICollection <JavaUnresolvableModel> unresolvables)
        {
            if (Name.Contains('$'))
            {
                unresolvables.Add(new JavaUnresolvableModel(this, "$", UnresolvableType.DollarSign));
                return;
            }

            var type_parameters = DeclaringType.GetApplicableTypeParameters().ToArray();

            try {
                TypeModel = types.ResolveTypeReference(TypeGeneric, type_parameters);
            } catch (JavaTypeResolutionException) {
                unresolvables.Add(new JavaUnresolvableModel(this, TypeGeneric, UnresolvableType.FieldType));

                return;
            }
        }
        public void Resolve(JavaTypeCollection types, ICollection <JavaUnresolvableModel> unresolvables)
        {
            var jtn = JavaTypeName.Parse(GenericType);

            if (jtn.ArrayPart == "...")
            {
                IsParameterArray = true;
            }

            var type_parameters = DeclaringMethod.GetApplicableTypeParameters().ToArray();

            try {
                TypeModel = types.ResolveTypeReference(GenericType, type_parameters);
            } catch (JavaTypeResolutionException) {
                unresolvables.Add(new JavaUnresolvableModel(this, Type, UnresolvableType.ParameterType));

                return;
            }
        }
Beispiel #3
0
        public virtual void Resolve(JavaTypeCollection types, ICollection <JavaUnresolvableModel> unresolvables)
        {
            var type_parameters = GetApplicableTypeParameters().ToArray();

            // Resolve any implemented interfaces
            foreach (var i in Implements)
            {
                try {
                    var implements = types.ResolveTypeReference(TypeResolutionOptions.ResolveGenerics ? i.NameGeneric : i.Name, type_parameters);

                    if (implements is null)
                    {
                        throw new Exception();
                    }

                    ImplementsModels.Add(implements);
                } catch (JavaTypeResolutionException) {
                    unresolvables.Add(new JavaUnresolvableModel(this, i.NameGeneric, UnresolvableType.ImplementsType));

                    throw;
                }
            }

            // Resolve members
            foreach (var method in Methods)
            {
                method.Resolve(types, unresolvables);
            }

            foreach (var field in Fields)
            {
                field.Resolve(types, unresolvables);
            }

            // Resolve nested types
            foreach (var child in NestedTypes)
            {
                child.Resolve(types, unresolvables);
            }
        }
        public override void Resolve(JavaTypeCollection types, ICollection <JavaUnresolvableModel> unresolvables)
        {
            if (Name.Contains('$'))
            {
                unresolvables.Add(new JavaUnresolvableModel(this, "$", UnresolvableType.DollarSign));
                return;
            }

            var type_parameters = GetApplicableTypeParameters().ToArray();

            try {
                ReturnTypeModel = types.ResolveTypeReference(Return, type_parameters);
            } catch (JavaTypeResolutionException) {
                unresolvables.Add(new JavaUnresolvableModel(this, Return, UnresolvableType.ReturnType));

                return;
            }

            foreach (var p in Parameters.OfType <JavaParameterModel> ())
            {
                p.Resolve(types, unresolvables);
            }
        }
Beispiel #5
0
        public override void Resolve(JavaTypeCollection types, ICollection <JavaUnresolvableModel> unresolvables)
        {
            var type_parameters = GetApplicableTypeParameters().ToArray();

            // Resolve base class
            if (FullName != "java.lang.Object" && FullName != "java.lang.Throwable")
            {
                try {
                    BaseTypeReference = types.ResolveTypeReference(TypeResolutionOptions.ResolveGenerics ? BaseTypeGeneric : BaseType, type_parameters);
                } catch (JavaTypeResolutionException) {
                    unresolvables.Add(new JavaUnresolvableModel(this, BaseTypeGeneric, UnresolvableType.BaseType));

                    throw;
                }

                // We don't resolve reference-only types by default, so if our base class
                // is a reference only type, we need to force it to resolve here. This will be
                // needed later when we attempt to resolve base methods.
                try {
                    if (BaseTypeReference.ReferencedType is JavaClassModel klass && klass.FullName != "java.lang.Object" && klass.BaseTypeReference is null && klass.IsReferencedOnly)
                    {
                        klass.Resolve(types, unresolvables);
                    }
                } catch (JavaTypeResolutionException) {
                    // Ignore
                }
            }

            // Resolve constructors
            foreach (var ctor in Constructors)
            {
                ctor.Resolve(types, unresolvables);
            }

            base.Resolve(types, unresolvables);
        }
Beispiel #6
0
 public override void Resolve(JavaTypeCollection types, ICollection <JavaUnresolvableModel> unresolvables)
 {
     throw new NotImplementedException();
 }
Beispiel #7
0
 public void Resolve(JavaTypeCollection types, ICollection <JavaUnresolvableModel> unresolvables)
 {
     // TODO: Resolve generic constraints
     //var type_parameters = GetApplicableTypeParameters ().ToArray ();
 }
 public abstract void Resolve(JavaTypeCollection types, ICollection <JavaUnresolvableModel> unresolvables);