Commit 15c8879
authored
[generator] Use decl type's @deprecated-since if < member's (#1068)
Context: https://discord.com/channels/732297728826277939/732297837953679412/1052239604905934848
Imagine a type is deprecated in API-25 but its members were not
explicitly marked as deprecated:
@deprecated
public class TabActivity extends ActivityGroup {
public void setDefaultTab(String tag) { ... }
}
Then in API-29 the member is explicitly marked as deprecated:
@deprecated
public class TabActivity extends ActivityGroup {
@deprecated
public void setDefaultTab(String tag) { ... }
}
Due to the way `api-merge` calculates `@deprecated-since`, these
would end up with different values, with a resulting C# API:
[ObsoletedOSPlatform("android25.0")]
public class TabActivity : ActivityGroup
{
[ObsoletedOSPlatform("android29.0")]
public void SetDefaultTab (string tag) { ... }
}
While technically "fine", it is confusing that the method says it was
obsoleted in API-29 instead of API-25.
To fix this, if a member has a "higher" `@deprecated-since` value
than its declaring type, we set the member's `@deprecated-since`
value to the declaring type's `@deprecated-since` value.1 parent 525a45d commit 15c8879
File tree
3 files changed
+40
-2
lines changed- tests/generator-Tests/Unit-Tests
- tools/generator/Java.Interop.Tools.Generator.Importers
3 files changed
+40
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
| 579 | + | |
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
602 | | - | |
603 | 602 | | |
604 | 603 | | |
605 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
81 | 90 | | |
82 | 91 | | |
83 | 92 | | |
| |||
138 | 147 | | |
139 | 148 | | |
140 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
141 | 159 | | |
142 | 160 | | |
143 | 161 | | |
| |||
212 | 230 | | |
213 | 231 | | |
214 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
215 | 242 | | |
216 | 243 | | |
217 | 244 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
194 | 198 | | |
195 | 199 | | |
196 | 200 | | |
| |||
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
233 | 241 | | |
234 | 242 | | |
235 | 243 | | |
| |||
398 | 406 | | |
399 | 407 | | |
400 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
401 | 413 | | |
402 | 414 | | |
403 | 415 | | |
| |||
0 commit comments