Commit fe60483
authored
[generator] Mark abstract methods as [Obsolete] if needed (#1011)
Fixes: #969
If you have a Java `abstract` method which is deprecated:
// Java
public abstract class Example {
@deprecated
public abstract void m();
}
then the C# binding is *not* `[Obsolete]`, *and* the `*Invoker`
override *is* `[Obsolete]`:
// Binding
public abstract partial class Example : Java.Lang.Object {
// Note: *not* [Obsolete]
[Register (…)]
public abstract void M();
}
internal partial class ExampleInvoker : Example {
[Obsolete]
public override void M() => …
}
This state of affairs results in a [CS0809 warning][0]:
warning CS0809: Obsolete member 'ExampleInvoker.M()' overrides non-obsolete member 'Example.M()'
Commit 37cff25 added a fix for this for `JavaInterop1` output, asking:
> TODO: should this change be done for *all* codegen targets?
The answer: Yes.
Expand the fix from 37cff25 to apply to `XAJavaInterop1` codegen,
and add unit tests for this scenario.
[0]: https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs08091 parent 275fa75 commit fe60483
File tree
2 files changed
+26
-3
lines changed- tests/generator-Tests/Unit-Tests
- tools/generator/SourceWriters
2 files changed
+26
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
505 | 530 | | |
506 | 531 | | |
507 | 532 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
| 56 | + | |
58 | 57 | | |
59 | | - | |
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
| |||
0 commit comments