Handle properties with getter or setter only [Obsolete]
attribute
#1033
Labels
enhancement
Proposed change to current functionality
generator
Issues binding a Java library (generator, class-parse, etc.)
Milestone
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 aget
or aset
, it can only be placed on the entire property.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:get
is obsolete and there is noset
get
andset
are obsoleteWe have this comment in our code:
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
.The text was updated successfully, but these errors were encountered: