Exemplo n.º 1
0
 public ArrayTypeInfo(JVMType type, int dimensions, TypeInfo elementType)
     : base(type)
 {
     this.Dimensions  = dimensions;
     this.ElementType = elementType;
 }
Exemplo n.º 2
0
 public TypeInfo(JVMType type)
 {
     this.Type = type;
 }
Exemplo n.º 3
0
 public ObjectTypeInfo(JVMType type, string className)
     : base(type)
 {
     this.ClassName = className;
 }
Exemplo n.º 4
0
        public void UpdateNames()
        {
            foreach (GType ifc in Interfaces)
            {
                foreach (GType inIfc in ifc.AllInterfaces)
                {
                    if (!AllInterfaces.Contains(inIfc))
                    {
                        AllInterfaces.Add(inIfc);
                    }
                }
            }
            if (IsCLRType)
            {
                CLRNamespace = CLRType.Namespace;
                Name         = CLRType.Name;
                if (!IsJVMType && JVMFullName == null)
                {
                    JVMNamespace = CLRNamespace.ToLowerInvariant();

                    if (CLRType.IsGenericType)
                    {
                        bool rref = typeof(Ref <>).IsAssignableFrom(CLRType.GetGenericTypeDefinition());
                        bool oout = typeof(Out <>).IsAssignableFrom(CLRType.GetGenericTypeDefinition());
                        if (rref || oout)
                        {
                            JVMFullName = JVMNamespace + (rref ? ".Ref<" : ".Out<");
                            Type[] genericArguments = CLRType.GetGenericArguments();
                            for (int i = 0; i < genericArguments.Length; i++)
                            {
                                Type argument = genericArguments[i];

                                if (argument.IsPrimitive)
                                {
                                    String objName = Repository.jvmPrimitives[argument].getName();
                                    JVMFullName += objName;
                                }
                                else
                                {
                                    GType real = Repository.RegisterType(argument);
                                    real.UpdateNames();
                                    JVMFullName += real.JVMResolved;
                                }
                                if (i + 1 < genericArguments.Length)
                                {
                                    JVMFullName += ",";
                                }
                            }
                            JVMFullName += ">";
                        }
                    }
                    else
                    {
                        JVMFullName = JVMNamespace + "." + CLRType.Name;
                    }
                }
            }
            if (IsJVMType)
            {
                JVMNamespace = JVMType.PackageName;
                Name         = JVMType.ShortName;
                if (!IsCLRType)
                {
                    CLRNamespace = JVMNamespace;

                    if (IsArray)
                    {
                        CLRFullName = JVMType.getComponentType().getName() + "[]";
                    }
                    else
                    {
                        CLRFullName = JVMType.FullName;
                    }
                }
            }
            JVMNamespaceExt = JVMNamespace;
            CLRNamespaceExt = CLRNamespace;
            if (JVMNamespace.StartsWith("java."))
            {
                JVMNamespaceExt = "java_." + JVMNamespace.Substring(5);
            }

            /* TODO
             * if (IsJVMGenerate)
             * {
             *  if (Base!=null && !Base.IsJVMType && !Base.IsJVMGenerate)
             *  {
             *      Console.WriteLine("you should add " + Base.Name);
             *  }
             *  foreach (GType ifc in Interfaces)
             *  {
             *      if (!ifc.IsJVMType && !ifc.IsJVMGenerate)
             *      {
             *          Console.WriteLine("you should add " + ifc.Name);
             *      }
             *  }
             * }
             *
             * if (IsCLRGenerate && CLRType!=typeof(IClrProxy))
             * {
             *  if (Base != null && !Base.IsCLRType && !Base.IsCLRGenerate)
             *  {
             *      Console.WriteLine("you should add " + Base.Name);
             *  }
             *  foreach (GType ifc in Interfaces)
             *  {
             *      if (!ifc.IsCLRType && !ifc.IsCLRGenerate)
             *      {
             *          Console.WriteLine("you should add " + ifc.Name);
             *      }
             *  }
             * }*/
        }