Skip to content

generator output should avoid mentioning non-public types #1269

Open
@jonpryor

Description

@jonpryor

Context: #1261

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

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions