Skip to content

Duplicate generated event handlers cause compilation failure #957

Open
@jpobst

Description

@jpobst

Context: dotnet/android#6750 (comment)
Workaround: https://github.com/xamarin/java.interop/wiki/Duplicate-Event-Handlers

Previously we did some work to support multiple listener methods with the same name, which involved ensuring duplicate EventArgs types were not generated. This seems good, but there is an additional consideration where the event handler is still duplicated, causing compilation to fail:

[global::Android.Runtime.Register ("mono/android/accessibilityservice/AccessibilityService_MagnificationController_OnMagnificationChangedListenerImplementor", ApiSince = 24)]
internal sealed partial class IOnMagnificationChangedListenerImplementor : global::Java.Lang.Object, IOnMagnificationChangedListener {

	object sender;

	public IOnMagnificationChangedListenerImplementor (object sender) : base (global::Android.Runtime.JNIEnv.StartCreateInstance ("mono/android/accessibilityservice/AccessibilityService_MagnificationController_OnMagnificationChangedListenerImplementor", "()V"), JniHandleOwnership.TransferLocalRef)
	{
		global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V");
		this.sender = sender;
	}

	#pragma warning disable 0649
	public EventHandler<MagnificationChangedEventArgs> OnMagnificationChangedHandler;
	#pragma warning restore 0649

	public void OnMagnificationChanged (Android.AccessibilityServices.AccessibilityService.MagnificationController controller, Android.Graphics.Region region, Android.AccessibilityServices.MagnificationConfig config)
	{
		var __h = OnMagnificationChangedHandler;
		if (__h != null)
			__h (sender, new MagnificationChangedEventArgs (controller, region, config));
	}

	#pragma warning disable 0649
	public EventHandler<MagnificationChangedEventArgs> OnMagnificationChangedHandler;
	#pragma warning restore 0649

	public void OnMagnificationChanged (Android.AccessibilityServices.AccessibilityService.MagnificationController controller, Android.Graphics.Region region, float scale, float centerX, float centerY)
	{
		var __h = OnMagnificationChangedHandler;
		if (__h != null)
			__h (sender, new MagnificationChangedEventArgs (controller, region, scale, centerX, centerY));
	}

	internal static bool __IsEmpty (IOnMagnificationChangedListenerImplementor value)
	{
		return value.OnMagnificationChangedHandler == null && value.OnMagnificationChangedHandler == null;
	}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugComponent does not function as intendedgeneratorIssues 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