Commit be6cc8f
authored
[Java.Interop] Add JniTypeSignatureAttribute.InvokerType (#1284)
Context: #1263
Context: #1263 (comment)
We want the default trimmer infrastructure to be able to automatically
preserve the `*Invoker` types which are required for interacting with
`abstract` classes and interfaces.
The most straightforward way to do this is to add a new `InvokerType`
property to `JniTypeSignatureAttribute` (and eventually
`RegisterAttribute`):
partial class JniTypeSignatureAttribute {
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors |
DynamicallyAccessedMemberTypes.NonPublicConstructors)]
public Type? InvokerType {get; set;}
}
Update `generator` so that `generator --codegen-target=JavaInterop1`
output sets this new property on abstract classes and interfaces:
namespace Java.Lang {
[Java.Interop.JniTypeSignatureAttribute("java/lang/Runnable", GenerateJavaPeer=false, InvokerType=typeof(Java.Lang.IRunnableInvoker))]
public partial interface IRunnable {
}
internal partial class IRunnableInvoker {
}
[Java.Interop.JniTypeSignatureAttribute("java/lang/Number", GenerateJavaPeer=false, InvokerType=typeof(Java.Lang.NumberInvoker))]
public abstract partial class Number {
}
internal partial class NumberInvoker {
}
}
This allows the default trimmer to automatically preserve the
`*Invoker` type and constructors.
Update `Java.Interop.JniRuntime.JniValueManager` to no longer look
for `*Invoker` types "by string", and instead require use of the
`JniTypeSignatureAttribute.InvokerType` property.
Update unit tests and expected output so that everything works.1 parent 619286d commit be6cc8f
File tree
37 files changed
+203
-201
lines changed- src
- Java.Interop
- Java.Interop
- tests
- Java.Interop-Tests/Java.Interop
- generator-Tests
- Unit-Tests/CodeGeneratorExpectedResults/JavaInterop1
- expected.ji
- AccessModifiers
- Adapters
- Android.Graphics.Color
- InterfaceMethodsConflict
- NestedTypes
- NormalProperties
- ParameterXPath
- Streams
- TestInterface
- java.lang.Enum
- java.util.List
- tools/generator/SourceWriters
- Attributes
37 files changed
+203
-201
lines changedLarge diffs are not rendered by default.
Lines changed: 8 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
390 | | - | |
391 | 389 | | |
392 | | - | |
393 | 390 | | |
394 | 391 | | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | 392 | | |
402 | 393 | | |
403 | 394 | | |
| |||
409 | 400 | | |
410 | 401 | | |
411 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
412 | 408 | | |
413 | 409 | | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
424 | 413 | | |
425 | 414 | | |
426 | 415 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
0 commit comments