diff --git a/src/Xamarin.Android.Tools.Bytecode/ClassPath.cs b/src/Xamarin.Android.Tools.Bytecode/ClassPath.cs index aee01e485..03429747b 100644 --- a/src/Xamarin.Android.Tools.Bytecode/ClassPath.cs +++ b/src/Xamarin.Android.Tools.Bytecode/ClassPath.cs @@ -26,7 +26,7 @@ public class ClassPath { public string ApiSource { get; set; } - public JavaDocletType DocletType { get; set; } + public JavaDocletType? DocletType { get; set; } public IEnumerable DocumentationPaths { get; set; } @@ -224,9 +224,28 @@ void FixupParametersFromDocs (XElement api) } } + JavaDocletType GetDocletType (string path) + { + var kind = JavaDocletType.DroidDoc; + char [] buf = new char [500]; + string packagesHtml = Path.Combine (path, "packages.html"); + if (File.Exists (packagesHtml) && File.ReadAllText (packagesHtml).Contains ("") { + ShouldEscapeBrackets = true; } string prev_path; @@ -115,13 +109,15 @@ public Java7DocScraper (string dir) class Java8DocScraper : AndroidDocScraper { - const String pattern_head_javadoc = " GetContentLines (string path) { return File.ReadAllText (path).Split ('\n'); @@ -197,11 +197,18 @@ public virtual String[] GetParameterNames (string package, string type, string m for (int i = 0; i < ptypes.Length; i++) { if (i != 0) buffer.Append (param_sep); - buffer.Append (ptypes [i].Replace ('$', '.')); + var ptype = ptypes [i]; + if (ShouldEliminateGenericArguments) + while (ptype.IndexOf ('<') > 0 && ptype.IndexOf ('>') > ptype.IndexOf ('<')) + ptype = ptype.Substring (0, ptype.IndexOf ('<')) + ptype.Substring (ptype.IndexOf ('>') + 1); + buffer.Append (ptype.Replace ('$', '.')); } - buffer.Replace ("[", "\\[").Replace ("]", "\\]"); + if (ShouldEscapeBrackets) + buffer.Replace ("[", "\\[").Replace ("]", "\\]"); + if (ShouldAlterArraySpec) + buffer.Replace ("[]", ":A"); buffer.Append (close_method); - buffer.Append ("\".*\\(([^(]*)\\)"); + buffer.Append ("\".*\\(([^\\(\\)]*)\\)"); buffer.Append (post_close_method_parens); buffer.Replace ("?", "\\?"); Regex pattern = new Regex (buffer.ToString (), RegexOptions.Multiline);