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
{{ message }}
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Handle properties with getter or setter only [Obsolete] attribute #1033
When we are converting Java getter/setter pairs to C# properties, we can hit an interesting scenario where a getter may be @Deprecated and the setter is not, or vice versa:
C# has traditionally not allowed [Obsolete] to be placed on just a get or a set, it can only be placed on the entire property.
[Obsolete]publicboolHasOptionsMenu{get;set;}
This can lead to confusion because using the getter will report an obsolete warning when it is not obsolete. Thus, for properties, we only add [Obsolete] in 2 cases:
The get is obsolete and there is no set
Both the get and set are obsolete
We have this comment in our code:
// Unlike [Register], [Obsolete] cannot be put on property accessors, so we can apply them only under limited condition...
However, the compiler team has determined that preventing [Obsolete] on property accessors was a bug, and has fixed it in C# 8: dotnet/roslyn#32571.
Thus we can update generator to support scenarios in which only the Java getter or setter is marked as @Deprecated.
Activity
[generator] Better support deprecated property getter/setters. (#1062)
[generator] Better support deprecated property getter/setters. (#1062)