Commit ae5b249
committed
[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.1 parent 0293360 commit ae5b249
1 file changed
+53
-30
lines changedLines changed: 53 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
384 | 418 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | 419 | | |
397 | 420 | | |
398 | 421 | | |
0 commit comments