Skip to content

Remove unused code in the interop layers #11854

Closed
Closed

Description

@filipnavara

Casual look at the Java.Interop/java-interop projects that there's a lot of code that can be removed since it's no longer used:

Activity

  1. added
    enhancement
    java-interop
    on Sep 30, 2024
  2. jonpryor commented on Oct 23, 2024

    @jonpryor
    Contributor

    I had written:

    The WeakReference code is effectively dead. The contents of src/java-interop is a "desktop port" of GC bridge code from dotnet/android for use with MonoVM, which we never got around to unifying. The WeakReference backend is no longer supported; see 2f93f76

    Additionally, note that the use of WeakReference was when JNI Weak Global References didn't work (Android < API-14).

    I was wrong. (Or at least, not quite right.)

    2f93f763 removes support for JNI Global References being direct object pointers. Meaning instead of there being an indirection (GREF value > GREF table > object instance), the GREF value was the object instance. In a world in which objects can move around in memory due to GC, "direct" references cannot work, but Android worked this way for quite some time (through API-13).

    Consequently, 2f93f763 is entirely unrelated to our code to use java.lang.ref.WeakReference instead of JNI Weak Global References.

    The java.lang.ref.WeakReference code can be used by setting the debug.mono.wref system property.

    That said, we have no current tests which set this property, and I see no obvious usage of debug.mono.wref on GitHub, so while this code may not be "dead", it's close to it

  3. jonpryor commented on Oct 25, 2024

    @jonpryor
    Contributor

    e98ae9c removes support for debug.mono.wref=java, java.lang.ref.WeakReference, and the weak_handle fields from Java.Lang.Object, Java.Lang.Exception, Java.Interop.JavaObject, and Java.Interop.JavaException.

    Development of dotnet/java-interop#1257 can resume, if desired.

  4. filipnavara commented on Oct 25, 2024

    @filipnavara
    MemberAuthor

    Development of #1257 can resume, if desired.

    I'll get to it in the upcoming week[s]. Thanks for the Android PR!

  5. added theissue type on Apr 29, 2025
  6. removed
    enhancement
    on Apr 29, 2025
  7. added
    java-interop
    needs-triage
    on Jul 1, 2026
  8. added
    possibly-stale
    on Jul 1, 2026
  9. dotnet-policy-service commented on Jul 1, 2026

    @dotnet-policy-service

    We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

  10. dotnet-policy-service commented on Jul 15, 2026

    @dotnet-policy-service

    This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

  11. locked and limited conversation to collaborators on Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    java-interopneeds-triagepossibly-stale

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions