Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[generator] Fix parameter string in ref doc links (#935)
Fixes: #931 Fixes: #932 We have a handful of issues in the https://developer.android.com/ links that are generated for various type members with complex parameters. Collections, varargs, and generics are some examples of items that are not translated correctly when generating the parameter portion of the reference documentation URL. The XML generated by `java-source-utils` when processing `android-stubs-src.jar` contains `<parameter/>` elements under all methods. The `<parameter/>` elements contain attributes with additional type data; for instance: <method jni-return="Landroid/animation/ObjectAnimator;" jni-signature="(Ljava/lang/Object;Landroid/util/Property;Landroid/util/Property;Landroid/graphics/Path;)Landroid/animation/ObjectAnimator;" name="ofFloat" return="android.animation.ObjectAnimator"> <parameter jni-type="Ljava/lang/Object;" name="target" type="T"/> <parameter jni-type="Landroid/util/Property;" name="xProperty" type="android.util.Property<T, java.lang.Float>"/> <parameter jni-type="Landroid/util/Property;" name="yProperty" type="android.util.Property<T, java.lang.Float>"/> <parameter jni-type="Landroid/graphics/Path;" name="path" type="android.graphics.Path"/> <javadoc> <![CDATA[Constructs and returns an ObjectAnimator that animates coordinates along a <code>Path</code> using two properties. A <code>Path</code></> animation moves in two dimensions, animating coordinates <code>(x, y)</code> together to follow the line. In this variation, the coordinates are floats that are set to separate properties, <code>xProperty</code> and <code>yProperty</code>. @param target The object whose properties are to be animated. @param xProperty The property for the x coordinate being animated. @param yProperty The property for the y coordinate being animated. @param path The <code>Path</code> to animate values along. @return An ObjectAnimator object that is set up to animate along <code>path</code>.]]> </javadoc> </method> Rather than processing the `//method/@jni-signature` attribute of the method, use the `//method/parameter/@type` attribute values to create more reliable type information for our reference documentation links. With these changes in place, instead of e.g. https://developer.android.com/reference/android/accounts/AccountManager#addAccount(java.lang.String,%20java.lang.String,%20java.lang.String[],%20android.os.Bundle,%20android.app.Activity,%20android.accounts.AccountManagerCallback,%20android.os.Handler) which doesn't anchor to the intended method documentation, we now emit https://developer.android.com/reference/android/accounts/AccountManager#addAccount(java.lang.String,%20java.lang.String,%20java.lang.String[],%20android.os.Bundle,%20android.app.Activity,%20android.accounts.AccountManagerCallback%3Candroid.os.Bundle%3E,%20android.os.Handler) which *does* anchor to the intended method documentation.
- Loading branch information