Skip to content

generator output should avoid mentioning non-public types #11849

Closed

Description

@jonpryor

Context: dotnet/java-interop#1261

dotnet/java-interop#1261 describes a scenario in which public interfaces inherit package-private types:

package net.dot.jni.test;

/* package */ interface BaseInterface {
    String m();
}

public interface InterfaceMethodInheritance extends BaseInterface, PublicInterface {
    String n();
}

/* package */ interface InternalInterface {
    String o();
}

public interface PublicInterface extends InternalInterface {
    String p();
}

The above is part of the tests/Java.Base-Tests build. After Java.Base-Tests is built, the following file is created: tests/Java.Base-Tests/obj/$(Configuration)-net8.0/_ji/mcw/Net.Dot.Jni.Test.IInterfaceMethodInheritance.cs

which contains:

namespace Net.Dot.Jni.Test {
	internal partial class IInterfaceMethodInheritanceInvoker : global::Java.Lang.Object, IInterfaceMethodInheritance {
		static readonly JniPeerMembers _members_net_dot_jni_test_BaseInterface = new JniPeerMembers ("net/dot/jni/test/BaseInterface", typeof (IInterfaceMethodInheritanceInvoker));

		static readonly JniPeerMembers _members_net_dot_jni_test_InterfaceMethodInheritance = new JniPeerMembers ("net/dot/jni/test/InterfaceMethodInheritance", typeof (IInterfaceMethodInheritanceInvoker));

		static readonly JniPeerMembers _members_net_dot_jni_test_InternalInterface = new JniPeerMembers ("net/dot/jni/test/InternalInterface", typeof (IInterfaceMethodInheritanceInvoker));

		static readonly JniPeerMembers _members_net_dot_jni_test_PublicInterface = new JniPeerMembers ("net/dot/jni/test/PublicInterface", typeof (IInterfaceMethodInheritanceInvoker));
	}
}

The concern is that the above snippet mentions two non-public types: net/dot/jni/test/BaseInterface and net/dot/jni/test/InternalInterface. If (when?) these types "go away" in the future -- they're not public, and thus could be removed or renamed at any point in time -- then the type initializer for IInterfaceMethodInheritanceInvoker will throw an exception, as e.g. new JniPeerMembers ("net/dot/jni/test/BaseInterface", …) will throw an exception because net/dot/jni/test/BaseInterface will not be found.

Activity

  1. added theissue type on Apr 29, 2025
  2. removed
    enhancementProposed change to current functionality.
    on Apr 29, 2025
  3. added
    java-interopIssues migrated from dotnet/java-interop / relates to the Java.Interop subtree
    needs-triageIssues that need to be assigned.
    Area: BindingsIssues in Java Library Binding projects.
    on Jul 1, 2026
  4. 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.

  5. 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.

  6. 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

    Area: BindingsIssues in Java Library Binding projects.java-interopIssues migrated from dotnet/java-interop / relates to the Java.Interop subtreeneeds-triageIssues that need to be assigned.possibly-staleIssues that are potentially no longer relevant.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions