[generator] When using interface-constants, remove or obsolete interface alternatives. #600
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: #509.
Due to our legacy workarounds for the C# shortcoming of not being able to place constants or members on interfaces, every interface with those members creates two additional "alternative" classes to provide users access to the members originally on the interface.
For example, the Java interface
android.os.Parcelable
creates:interface IParcelable
containing the interface declarationclass ParcelableConsts
containing the constants that are onParcelable
class Parcelable
contains the constants and static members that are onParcelable
Now that we can support members on interfaces, we would like to start the process of removing these interface alternatives.
ParcelableConsts class
The XXXXConsts classes have been
[Obsolete]
for over 5 years, and have been[Obsolete (iserror: true)]
since 16.4. They haven't beeniserror: true
for long enough to completely remove, but we can remove them when--lang-features:interface-constants
is specified.In terms of
Mono.Android.dll
, this means these classes will be removed for theAPI-R
binding, but will still exist in previous bindings.Parcelable class
The XXXX class is now redundant when
interface-constants
anddefault-interface-methods
is specified, as all members of the interface can be generated on the interface.In this case, we
[Obsolete]
all members in the alternativeParcelable
class with a message pointing to the original interface. Note that if the member already had[Obsolete]
for another reason (like being deprecated in Java) we preserve that message instead.In terms of
Mono.Android.dll
, this means these classes and their members will be[Obsolete]
in theAPI-R
binding, but not be obsoleted in previous bindings.Also fixed a bug where fields that are marked
[Obsolete]
that are being changed into property getters where not having the obsolete attribute applied.Here's the diff on
Mono.Android.dll
: https://gist.github.com/jpobst/717e67d6d21638c0600511ee34469c1d. Note thatmono-api-html
apparently doesn't show removed classes, so I had to run it backwards. Thus everything reported as "additions" are actually "removals".