Skip to content

Renaming methods in an abstract class does not rename all the components #496

@mattleibow

Description

@mattleibow

Assume a Kotlin-generated class:

public abstract class ClockMark {
    public ClockMark plus-LRDsOJo(double duration) { ... }
}

Besides all the issues in #464 and #466 which I work around for now, I write this <attr /> element to rename the member:

<attr path="/api/package[@name='kotlin.time']/class[@name='ClockMark']/method[@name='minus-LRDsOJo' and count(parameter)=1 and parameter[1][@type='double']]" name="managedName">Minus</attr>

This element does rename the public component, but the name of the delegate is not changed accordingly - resulting in invalid C# code.

static Delegate cb_minus-LRDsOJo_D;
#pragma warning disable 0169
static Delegate GetMinus_DHandler ()
{
	if (cb_minus-LRDsOJo_D == null)
		cb_minus-LRDsOJo_D = JNINativeWrapper.CreateDelegate ((Func<IntPtr, IntPtr, double, IntPtr>) n_Minus_D);
	return cb_minus-LRDsOJo_D;
}

static IntPtr n_Minus_D (IntPtr jnienv, IntPtr native__this, double p0)
{
	global::Kotlin.Time.ClockMark __this = global::Java.Lang.Object.GetObject<global::Kotlin.Time.ClockMark> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
	return JNIEnv.ToLocalJniHandle (__this.Minus (p0));
}
#pragma warning restore 0169

// Metadata.xml XPath method reference: path="/api/package[@name='kotlin.time']/class[@name='ClockMark']/method[@name='minus-LRDsOJo' and count(parameter)=1 and parameter[1][@type='double']]"
[Register ("minus-LRDsOJo", "(D)Lkotlin/time/ClockMark;", "GetMinus_DHandler")]
public virtual unsafe global::Kotlin.Time.ClockMark Minus (double p0)
{
	const string __id = "minus-LRDsOJo.(D)Lkotlin/time/ClockMark;";
	try {
		JniArgumentValue* __args = stackalloc JniArgumentValue [1];
		__args [0] = new JniArgumentValue (p0);
		var __rm = _members.InstanceMethods.InvokeVirtualObjectMethod (__id, this, __args);
		return global::Java.Lang.Object.GetObject<global::Kotlin.Time.ClockMark> (__rm.Handle, JniHandleOwnership.TransferLocalRef);
	} finally {
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions