Skip to content

Commit

Permalink
[generator] Process Javadoc for nested types (#996)
Browse files Browse the repository at this point in the history
Fixes: #992

Looking at the latest set of API docs for [a nested type][0] I noticed
that we were missing a lot of content that should have been produced by
the Mono.Android build when translating Javadoc to C# doc comments.

After further investigation, we realized that we were not attempting to
process and translate Javadoc for _any_ nested types.

Fix this oversight by adding a missing Javadoc processing iteration
over each type's nested types.

Additionally, Java documentation URLs for nested types have been fixed
by replacing `$` with `.` in both the URL and text for the URL.  This
replaces the previous URL of e.g.

	https://developer.android.com/reference/android/accessibilityservice/AccessibilityButtonController$AccessibilityButtonCallback

with:

	https://developer.android.com/reference/android/accessibilityservice/AccessibilityButtonController.AccessibilityButtonCallback

[0]: https://github.com/xamarin/android-api-docs/blame/b4084443c0354661e2257eb698e03d3fe1d86f1b/docs/Mono.Android/en/Android.AccessibilityServices/AccessibilityButtonController%2BAccessibilityButtonCallback.xml#L25
  • Loading branch information
pjcollins authored Jun 27, 2022
1 parent 7716ae5 commit 4b4fedd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,10 @@ static XElement CreateAndroidDocLinkUri (string prefix, string declaringJniType,
// Example: "https://developer.android.com/reference/android/app/Application#registerOnProvideAssistDataListener(android.app.Application.OnProvideAssistDataListener)"
// Example: "https://developer.android.com/reference/android/animation/ObjectAnimator#ofFloat(T,%20android.util.Property%3CT,%20java.lang.Float%3E,%20float...)"

declaringJniType = declaringJniType.Replace ("$", ".");
var java = new StringBuilder (declaringJniType)
.Replace ("/", ".")
.Replace ("$", ".");
.Replace ("/", ".");

var url = new StringBuilder (prefix);
if (!prefix.EndsWith ("/", StringComparison.Ordinal)) {
url.Append ("/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public static void Fixup (List<GenBase> gens, CodeGeneratorOptions options)

foreach (var type in gens) {
AddJavadoc (type, typeJavadocs, options.XmldocStyle);
foreach (var nested in type.NestedTypes) {
AddJavadoc (nested, typeJavadocs, options.XmldocStyle);
}
}
}

Expand Down

0 comments on commit 4b4fedd

Please sign in to comment.