void FixOldConstants(StreamWriter sw) { foreach (var pair in remove_nodes) { var enu = pair.Key; string package, type, member; ParseJniMember(enu, out package, out type, out member); if (pair.Value != null) { sw.WriteLine(" <attr path=\"/api/package[@name='{0}']/{3}[@name='{1}']/field[@name='{2}']\" name=\"type\">{4}</attr>", package, type, member, enu.StartsWith("I:", StringComparison.Ordinal) ? "interface" : "class", pair.Value); sw.WriteLine(" <attr path=\"/api/package[@name='{0}']/{3}[@name='{1}']/field[@name='{2}']\" name=\"deprecated\">This constant will be removed in the future version. Use {4} enum directly instead of this field.</attr>", package, type, member, enu.StartsWith("I:", StringComparison.Ordinal) ? "interface" : "class", pair.Value); sw.WriteLine(" <attr path=\"/api/package[@name='{0}']/{3}[@name='{1}']/field[@name='{2}']\" name=\"deprecated-error\">true</attr>", package, type, member, enu.StartsWith("I:", StringComparison.Ordinal) ? "interface" : "class", pair.Value); continue; } try { sw.WriteLine(" <remove-node path=\"/api/package[@name='{0}']/{3}[@name='{1}']/field[@name='{2}']\" />", package, type, member, enu.StartsWith("I:", StringComparison.Ordinal) ? "interface" : "class"); } catch (Exception ex) { Report.LogCodedErrorAndExit(Report.ErrorFailedToRemoveConstants, ex, enu); throw; } } }
// <remove-node path="/api/package[@name='java.lang']/class[@name='Float']/field[@name='MAX_VALUE']" /> void RemoveOldConstants(StreamWriter sw) { foreach (var e in remove_nodes) { string enu = e.Key; string package, type, member; ParseJniMember(enu, out package, out type, out member); try { sw.WriteLine(" <remove-node path=\"/api/package[@name='{0}']/{3}[@name='{1}']/field[@name='{2}']\" />", package, type, member, enu.StartsWith("I:", StringComparison.Ordinal) ? "interface" : "class"); } catch (Exception ex) { Report.LogCodedErrorAndExit(Report.ErrorFailedToRemoveConstants, ex, enu); throw; } } }
internal List <ApiTransform> ParseMethodMappings(TextReader source, int filter_version) { var list = new List <ApiTransform> (); if (source == null) { return(list); } string s; bool preserveTypeMode = false; while ((s = source.ReadLine()) != null) { if (s.Trim() == "---- PRESERVE TYPE MODE ----") { preserveTypeMode = true; } if (s.Length == 0 || s.StartsWith("//", StringComparison.Ordinal)) { continue; } var items = s.Split(','); int ver; if (filter_version > 0 && int.TryParse(items [0], out ver) && filter_version < ver) { continue; } try { list.Add(new ApiTransform(preserveTypeMode, items)); } catch (Exception ex) { Report.LogCodedErrorAndExit(Report.ErrorFailedToProcessEnumMap, ex, s); throw; } } return(list); }
public string GetOutputName(string type) { // Handle a few special cases if (type == "System.Void") { return("void"); } if (type.StartsWith("params ", StringComparison.Ordinal)) { return("params " + GetOutputName(type.Substring("params ".Length))); } if (type.StartsWith("global::", StringComparison.Ordinal)) { Report.LogCodedErrorAndExit(Report.ErrorUnexpectedGlobal); } if (!UseGlobal) { return(type); } // Add "global::" in front of types return(ParsedType.Parse(type).ToString(UseGlobal)); }