Exemplo n.º 1
0
 public static void Load(this JavaGenericConstraint gc, XmlReader reader)
 {
     gc.Type = XmlUtil.GetRequiredAttribute(reader, "type");
     XmlUtil.CheckExtraneousAttributes("genericConstraint", reader, "type");
     reader.Skip();
 }
Exemplo n.º 2
0
 internal static void Load(this JavaException e, XmlReader reader)
 {
     e.Name = XmlUtil.GetRequiredAttribute(reader, "name");
     e.Type = XmlUtil.GetRequiredAttribute(reader, "type");
     reader.Skip();
 }
Exemplo n.º 3
0
        public static void Load(this JavaTypeParameter tp, XmlReader reader)
        {
            tp.Name = XmlUtil.GetRequiredAttribute(reader, "name");
            tp.ExtendedJniClassBound = reader.GetAttribute("jni-classBound");
            // such an ill-named attribute...
            tp.ExtendedClassBound = reader.GetAttribute("classBound");
            // and un-structuring attribute...
            tp.ExtendedInterfaceBounds    = reader.GetAttribute("interfaceBounds");
            tp.ExtendedJniInterfaceBounds = reader.GetAttribute("jni-interfaceBounds");
            XmlUtil.CheckExtraneousAttributes("typeParameter", reader, "name", "jni-classBound", "jni-interfaceBounds", "classBound", "interfaceBounds");
            if (reader.IsEmptyElement)
            {
                reader.Read();
            }
            else
            {
                reader.Read();
                do
                {
                    reader.MoveToContent();
                    if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        break;                         // </typeParameter>
                    }
                    if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "genericConstraints")
                    {
                        throw XmlUtil.UnexpectedElementOrContent("typeParameter", reader, "genericConstraints");
                    }

                    var gc = new JavaGenericConstraints();
                    gc.Load(reader);
                    tp.GenericConstraints = gc;
                } while (true);

                XmlUtil.VerifyEndElement(reader, "typeParameter");
                reader.Read();
            }
            // Now we have to deal with the format difference...
            // Some versions of class-parse stopped generating <genericConstraints> but started
            // generating "classBound" and "interfaceBounds" attributes instead.
            // They don't make sense and blocking this effort, but we have to deal with that...
            if (!string.IsNullOrEmpty(tp.ExtendedClassBound) || !string.IsNullOrEmpty(tp.ExtendedInterfaceBounds))
            {
                var gcs = new JavaGenericConstraints();
                if (!string.IsNullOrEmpty(tp.ExtendedClassBound))
                {
                    gcs.GenericConstraints.Add(new JavaGenericConstraint()
                    {
                        Type = tp.ExtendedClassBound
                    });
                }
                if (!string.IsNullOrEmpty(tp.ExtendedInterfaceBounds))
                {
                    foreach (var ic in tp.ExtendedInterfaceBounds.Split(':'))
                    {
                        gcs.GenericConstraints.Add(new JavaGenericConstraint()
                        {
                            Type = ic
                        });
                    }
                }
                tp.GenericConstraints = gcs;
            }
        }
Exemplo n.º 4
0
 internal static void Load(this JavaParameter p, XmlReader reader)
 {
     p.Name = XmlUtil.GetRequiredAttribute(reader, "name");
     p.Type = XmlUtil.GetRequiredAttribute(reader, "type");
     reader.Skip();
 }