You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[class-parse] Import parameter names for unresolvable types
Fixes: #920
Context: 69e1b80
`java-source-utils.jar` isn't always able to fully resolve types.
When it is unable to do so, it uses an "alternate encoding":
> In some scenarios, types won't be resolvable. What should output be?
>
> We don't want to *require* that everything be resolvable -- it's painful, and
> possibly impossible, e.g. w/ internal types -- so instead we should "demark"
> the unresolvable types.
>
> `.params.txt` output will use `.*` as a type prefix, e.g.
>
> method(.*UnresolvableType foo, int bar);
>
> `docs.xml` will output `L.*UnresolvableType;`.
The problem is that `class-parse --parameter-names=PATH` didn't check
for this "unresolvable type" pattern, so if you had a method which
contained them, e.g. the `target` parameter in:
<interface jni-signature="Landroidx/core/view/NestedScrollingParent3;" name="NestedScrollingParent3">
<method jni-return="V" jni-signature="(L.*View;IIIII[I)V" name="onNestedScroll" return="void">
<parameter jni-type="L.*View;" name="target" type=".*View"/>
<parameter jni-type="I" name="dxConsumed" type="int"/>
<parameter jni-type="I" name="dyConsumed" type="int"/>
<parameter jni-type="I" name="dxUnconsumed" type="int"/>
<parameter jni-type="I" name="dyUnconsumed" type="int"/>
<parameter jni-type="I" name="type" type="int"/>
<parameter jni-type="[I" name="consumed" type="int[]"/>
then `class-parse --parameter-names=params.xml lib.jar` wouldn't
try to "loosely match" these parameter types. Consequently,
parameter names were not imported.
Update `ApiXmlDocScraper.GetParameterNames()` twofold:
1. Use XLinq instead of computing an XPath expression, and
2. Loosely match parameter types when `//parameter/@jni-name`
starts with `L.*`.
This allows us to import parameter names for unresolvable types.
0 commit comments