static void ResolveMethodBase(this JavaMethodBase m, JavaTypeParameters methodTypeParameters) { foreach (var p in m.Parameters) { p.ResolvedType = m.GetApi().Parse(p.Type, m.Parent.TypeParameters, methodTypeParameters); } }
static void LoadMethodBase(this JavaMethodBase methodBase, string elementName, XmlReader reader) { var method = methodBase as JavaMethod; // kind of ugly hack yeah... methodBase.LoadMemberAttributes(reader); //methodBase.ExtendedJniSignature = reader.GetAttribute ("jni-signature"); methodBase.ExtendedJniReturn = reader.GetAttribute("jni-return"); methodBase.ExtendedSynthetic = XmlConvert.ToBoolean(reader.GetAttribute("synthetic") ?? "false"); methodBase.ExtendedBridge = XmlConvert.ToBoolean(reader.GetAttribute("bridge") ?? "false"); reader.MoveToElement(); if (reader.IsEmptyElement) { reader.Read(); } else { reader.Read(); do { reader.MoveToContent(); if (reader.NodeType == XmlNodeType.EndElement) { break; } if (reader.NodeType != XmlNodeType.Element) { throw XmlUtil.UnexpectedElementOrContent(elementName, reader, "parameter"); } if (reader.LocalName == "typeParameters") { var tp = new JavaTypeParameters(methodBase); tp.Load(reader); methodBase.TypeParameters = tp; } else if (reader.LocalName == "parameter") { var p = new JavaParameter(methodBase); p.Load(reader); methodBase.Parameters.Add(p); } else if (reader.LocalName == "exception") { var p = new JavaException(); p.Load(reader); methodBase.Exceptions.Add(p); } else { throw XmlUtil.UnexpectedElementOrContent(elementName, reader, "parameter"); } } while (true); XmlUtil.VerifyEndElement(reader, elementName); reader.Read(); } }
static void Load(this JavaMethodBase method, MethodBase gm) { method.Deprecated = gm.Deprecated; method.Visibility = gm.Visibility; method.Parameters = gm.Parameters.Select(_ => new JavaParameter() { Name = _.JavaName, Type = _.RawNativeType, }).ToArray(); }
static void ResolveMethodBase(this JavaMethodBase m) { if (m.TypeParameters != null) { m.TypeParameters.Resolve(m.GetApi(), m.TypeParameters); } foreach (var p in m.Parameters) { p.ResolvedType = m.GetApi().Parse(p.Type, m.Parent.TypeParameters, m.TypeParameters); } }
static void FindParametersDefects(this JavaMethodBase methodBase) { int dummy; foreach (var p in methodBase.Parameters) { if (p.Name.StartsWith("p", StringComparison.Ordinal) && int.TryParse(p.Name.Substring(1), out dummy)) { Console.Error.WriteLine("Warning: {0} in {1} has 'unnamed' parameters", methodBase.Parent, methodBase); break; // reporting once is enough. } } }
static JavaTypeReference GetVisibleNonSpecialType(this JavaMethodBase method, JavaTypeReference r) { if (r == null || r.SpecialName != null || r.ReferencedTypeParameter != null || r.ArrayPart != null) { return(null); } var requiredVisibility = method.Visibility == "public" && method.Parent.Visibility == "public" ? "public" : method.Visibility; for (var t = r; t != null; t = (t.ReferencedType as JavaClass)?.ResolvedExtends) { if (t.ReferencedType == null) { break; } if (IsAcceptableVisibility(required: requiredVisibility, actual: t.ReferencedType.Visibility)) { return(t); } } return(null); }
public JavaTypeParameters(JavaMethodBase parent) { ParentMethod = parent; TypeParameters = new List <JavaTypeParameter> (); }
public JavaParameter(JavaMethodBase parent) { Parent = parent; }