Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

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

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
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
varjava=newStringBuilder(declaringJniType)
261-
.Replace("/",".")
262-
.Replace("$",".");
262+
.Replace("/",".");
263+
263264
varurl=newStringBuilder(prefix);
264265
if(!prefix.EndsWith("/",StringComparison.Ordinal)){
265266
url.Append("/");

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public static void Fixup (List<GenBase> gens, CodeGeneratorOptions options)
4646

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

0 commit comments

Comments
 (0)