Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
This repository was archived by the owner on Aug 27, 2026. It is now read-only.

Additional API-30 deprecations #602

Closed

Description

@jpobst

From #509:

Additional/related changes:

We should also [Obsolete(error:true)] all of the nested InterfaceConsts types, such as Android.OS.Binder.InterfaceConsts.


For API-30, we should [Obsolete(error:true)] "interface proxy" types such as Android.Content.ComponentCallbacks2, which contains fields for the android.content.ComponentCallbacks2 interface and lives "alongside" the Android.Content.IComponentCallbacks2 interface. Additionally, all of these fields should be moved into the appropriate C# interface, e.g. every field within Android.Content.ComponentCallbacks2 should reside in the Android.Content.IComponentCallbacks2 type, using C#8 default interface members.

^^ This was done in #600. We did not make them an error to allow a smoother migration path, as the new members would not be available in API-29.


We should also [Obsolete(error:true)] all members which are already [Obsolete].

^^ I'm not aware of any additional members that need to be changed.

Activity

  1. added this to the d16-7 milestone on Apr 6, 2020
  2. added
    generatorIssues binding a Java library (generator, class-parse, etc.)
    enhancementProposed change to current functionality
    on Apr 6, 2020
  3. self-assigned this
    on Apr 8, 2020
  4. jpobst commented on Apr 14, 2020

    @jpobst
    ContributorAuthor

    I am somewhat concerned about removing the InterfaceConsts classes. The scenario they "fix" is allowing the constants on an inherited interface to be accessed through the implementing class.

    For example:

    interface IFoo { public const int Bar = 3; }
    class Baz : IFoo { }
    

    In Java, you can access this as an "inherited constant" like this:

    new Baz ().Bar
    

    Because we didn't have interface constants in C#, the constant is moved to a class, which we cannot inherit from or we break the inheritance hierarchy:

    class Foo { public const int Bar = 3; }
    class Baz : Java.Lang.Object
    

    Obviously new Baz ().Bar doesn't work here. The workaround was to create the nested InterfaceConsts which theoretically makes it slightly more findable, in that you can do this:

    new Baz ().InterfaceConsts.Bar
    

    With C#8, we now have interface constants, but the way they work in C# means they are only available on the interface and are not accessible via inheritance, thus new Baz ().Bar still doesn't work, even though Baz inherits an interface with a Bar constant. It is only accessible as IFoo.Bar.

    Thus, we have not eliminated the problem InterfaceConsts were trying to fix in the first place: we still do not allow a literal translation from Java code.

    One can argue that InterfaceConsts should be removed just because it's a bad solution in the first place, but we should not remove it simply because we think C#8 fixes the problem it attempts to solve.

  5. jpobst commented on Apr 15, 2020

    @jpobst
    ContributorAuthor

    We have decided not to proceed with this and will leave the InterfaceConsts classes as-is.

  6. locked and limited conversation to collaborators on Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementProposed change to current functionalitygeneratorIssues binding a Java library (generator, class-parse, etc.)

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions