Skip to content

Hide Java.Lang.Object members meant only for internal use #4582

Closed

Description

@bramborman

Hi, this is not a very important issue, but something I guess would make a dev's life a bit easier :)

I work with Xamarin.Android so I use mostly objects that are bound from Java libs so they inherit from the Java.Lang.Object class. The problem here is that it has a few public members that are intended for internal Java.Interop use only. For instance public IntPtr Handle or public JniObjectReference PeerReference.

So I'm wondering whether it'd be possible to hide these members as they're making an unwanted noise in IntelliSense and could also possibly lead to some confusion or errors when mistakenly used. The best would of course be to make them internal or something like that or, if that's not possible, the EditorBrowsable(EditorBrowsableState.Never) attribute could be added to remove that noise.

Activity

  1. bramborman commented on Apr 18, 2020

    @bramborman
    Author

    Also it could be worth adding the [DebuggerBrowsable(DebuggerBrowsableState.Never)] attribute if the members cannot be made internal or so to hide the members when debugging.

  2. jpobst commented on Apr 20, 2020

    @jpobst
    Contributor

    Unfortunately they cannot be made internal, as they are used by bindings libraries.

    I really like your idea to at least hide them from the editor/debugger. I'll look into doing that!

    I'm going to move this to the Xamarin.Android repo, as the code for Java.Lang.Object is actually over there.

  3. transferred this issue fromdotnet/java-interopon Apr 20, 2020
  4. self-assigned this
    on Apr 20, 2020
  5. added this to the Under Consideration milestone on Apr 20, 2020
  6. brendanzagaeski commented on May 20, 2020

    @brendanzagaeski
    Contributor

    Release status update

    A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this again when a Release version is available that includes the fix.

    Fix included in Xamarin.Android 10.3.99.230.

    Fix included on Windows in Visual Studio 2019 version 16.7 Preview 1. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.

    Fix included on macOS in Visual Studio 2019 for Mac version 8.7 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.

  7. brendanzagaeski commented on Aug 5, 2020

    @brendanzagaeski
    Contributor

    Release status update

    A new Release version of Xamarin.Android has now been published that includes the fix for this item.

    Fix included in Xamarin.Android SDK version 11.0.0.3.

    Fix included on Windows in Visual Studio 2019 version 16.7. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/.

    Fix included on macOS in Visual Studio 2019 for Mac version 8.7. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.

  8. bramborman commented on Aug 6, 2020

    @bramborman
    Author

    Hi, I just downloaded the latest VS 16.7 and wanted to look at this fix but I found there's a problem with classes that inherit from Java.Lang.Object that override these now hidden properties. For instance Android.App.Activity overrides ThresholdClass so it is then visible in IntelliSense and this fix has no effect :/
    I guess the bindings generator will need to be updated too to add these attributes on the overrides.

  9. jpobst commented on Aug 6, 2020

    @jpobst
    Contributor

    Good point, I added dotnet/java-interop#688 to address this.

  10. ghost locked as resolved and limited conversation to collaborators on Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: BindingsIssues in Java Library Binding projects.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions