Skip to content

Commit 4b4fedd

Browse files
authored
[generator] Process Javadoc for nested types (#996)
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
1 parent 7716ae5 commit 4b4fedd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tools/generator/Java.Interop.Tools.Generator.ObjectModel/JavadocInfo.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,10 @@ static XElement CreateAndroidDocLinkUri (string prefix, string declaringJniType,
257257
// Example: "https://developer.android.com/reference/android/app/Application#registerOnProvideAssistDataListener(android.app.Application.OnProvideAssistDataListener)"
258258
// Example: "https://developer.android.com/reference/android/animation/ObjectAnimator#ofFloat(T,%20android.util.Property%3CT,%20java.lang.Float%3E,%20float...)"
259259

260+
declaringJniType = declaringJniType.Replace ("$", ".");
260261
var java = new StringBuilder (declaringJniType)
261-
.Replace ("/", ".")
262-
.Replace ("$", ".");
262+
.Replace ("/", ".");
263+
263264
var url = new StringBuilder (prefix);
264265
if (!prefix.EndsWith ("/", StringComparison.Ordinal)) {
265266
url.Append ("/");

tools/generator/Java.Interop.Tools.Generator.Transformation/JavadocFixups.cs

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public static void Fixup (List<GenBase> gens, CodeGeneratorOptions options)
4646

4747
foreach (var type in gens) {
4848
AddJavadoc (type, typeJavadocs, options.XmldocStyle);
49+
foreach (var nested in type.NestedTypes) {
50+
AddJavadoc (nested, typeJavadocs, options.XmldocStyle);
51+
}
4952
}
5053
}
5154

0 commit comments

Comments
 (0)