Skip to content

Commit a295eab

Browse files
authored
[generator] Fix potential callback naming conflict (#1239)
Fixes: #1155 Context: https://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html A *bridge method* is a Java compiler-generated method "overload" which deals with type coercion, to support Java type erasure: package com.google.mlkit.vision.objects; // https://developers.google.com/android/reference/com/google/mlkit/vision/objects/ObjectDetectorOptionsBase public class ObjectDetectorOptionsBase { /** @hide */ public static class Builder<B extends Builder> { public B setDetectorMode(int detectorMode) {…} } } package com.google.mlkit.vision.objects.defaults; public class ObjectDetectorOptions { // https://developers.google.com/android/reference/com/google/mlkit/vision/objects/defaults/ObjectDetectorOptions.Builder public static class Builder extends ObjectDetectorOptionsBase.Builder<Builder> { public Builder setDetectorMode(int detectorMode) {…} } } It *looks like* there is only one `ObjectDetectorOptions.Builder.setDetectorMode()` method, but there are in fact *two*. The first is the bridge method (`ACC_BRIDGE`), the second method is the "real" method; they differ on return type: % javap -cp classes.jar -s -v 'com/google/mlkit/vision/objects/defaults/ObjectDetectorOptions$Builder' … public final com.google.mlkit.vision.objects.ObjectDetectorOptionsBase$Builder setDetectorMode(int); descriptor: (I)Lcom/google/mlkit/vision/objects/ObjectDetectorOptionsBase$Builder; flags: (0x1051) ACC_PUBLIC, ACC_FINAL, ACC_BRIDGE, ACC_SYNTHETIC … public com.google.mlkit.vision.objects.defaults.ObjectDetectorOptions$Builder setDetectorMode(int); descriptor: (I)Lcom/google/mlkit/vision/objects/defaults/ObjectDetectorOptions$Builder; flags: (0x0001) ACC_PUBLIC This is represented within `class-parse` XML as: <method abstract="false" deprecated="not deprecated" final="false" name="setDetectorMode" jni-signature="(I)Lcom/google/mlkit/vision/objects/defaults/ObjectDetectorOptions$Builder;" bridge="false" native="false" return="com.google.mlkit.vision.objects.defaults.ObjectDetectorOptions.Builder" jni-return="Lcom/google/mlkit/vision/objects/defaults/ObjectDetectorOptions$Builder;" static="false" synchronized="false" synthetic="false" visibility="public" return-not-null="true"> <parameter name="detectorMode" type="int" jni-type="I" /> </method> <method abstract="false" deprecated="not deprecated" final="true" name="setDetectorMode" jni-signature="(I)Lcom/google/mlkit/vision/objects/ObjectDetectorOptionsBase$Builder;" bridge="true" native="false" return="java.lang.Object" jni-return="Lcom/google/mlkit/vision/objects/ObjectDetectorOptionsBase$Builder;" static="false" synchronized="false" synthetic="true" visibility="public" return-not-null="true"> <parameter name="p0" type="int" jni-type="I" /> </method> The method with `bridge="true"` is the bridge method. When bound in C#, this causes an issue because two methods cannot have the same method name and parameter types: // C# binding public partial class ObjectDetectorOptions { public partial class Builder { public virtual MLKit.Vision.Objects.Defaults.ObjectDetectorOptions.Builder SetDetectorMode (int detectorMode); public virtual MLKit.Vision.Objects.ObjectDetectorOptionsBase.Builder SetDetectorMode (int p0); } } We can set `managedName` metadata to rename one of these methods: <attr path="//method[@name='setDetectorMode' and @bridge='true']" name="managedName>SetDetectorMode2</attr> However, we generate the callback delegate field with the algorithm `$"cb_{JavaName}{IDSignature}"`, so this identifier is still used twice, preventing C# compilation: // C# binding public partial class ObjectDetectorOptions { public partial class Builder { static Delegate cb_setDetectorMode_I; static Delegate cb_setDetectorMode_I; } } The solution is to add both the _managed_ name and the return type to the callback naming algorithm to ensure that it will always be unique for a method: `$"cb_{JavaName}_{Name}{IDSignatureWithReturnType}"`: // C# binding public partial class ObjectDetectorOptions { public partial class Builder { static Delegate cb_setDetectorMode_SetDetectorMode_I_Lcom_google_mlkit_vision_objects_defaults_ObjectDetectorOptions$Builder_; static Delegate cb_setDetectorMode_SetDetectorMode2_I_Lcom_google_mlkit_vision_objects_ObjectDetectorOptions$Builder_; } }
1 parent 9d10df1 commit a295eab

File tree

67 files changed

+647
-598
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+647
-598
lines changed

tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteDuplicateInterfaceEventArgs.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ internal partial class AnimatorListenerInvoker : global::Java.Lang.Object, Anima
6666
JNIEnv.DeleteLocalRef (local_ref);
6767
}
6868

69-
static Delegate cb_OnAnimationEnd_I;
69+
static Delegate cb_OnAnimationEnd_OnAnimationEnd_I_Z;
7070
#pragma warning disable 0169
7171
static Delegate GetOnAnimationEnd_IHandler ()
7272
{
73-
if (cb_OnAnimationEnd_I == null)
74-
cb_OnAnimationEnd_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_Z (n_OnAnimationEnd_I));
75-
return cb_OnAnimationEnd_I;
73+
if (cb_OnAnimationEnd_OnAnimationEnd_I_Z == null)
74+
cb_OnAnimationEnd_OnAnimationEnd_I_Z = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_Z (n_OnAnimationEnd_I));
75+
return cb_OnAnimationEnd_OnAnimationEnd_I_Z;
7676
}
7777

7878
static bool n_OnAnimationEnd_I (IntPtr jnienv, IntPtr native__this, int param1)
@@ -92,13 +92,13 @@ internal partial class AnimatorListenerInvoker : global::Java.Lang.Object, Anima
9292
return JNIEnv.CallBooleanMethod (((global::Java.Lang.Object) this).Handle, id_OnAnimationEnd_I, __args);
9393
}
9494

95-
static Delegate cb_OnAnimationEnd_II;
95+
static Delegate cb_OnAnimationEnd_OnAnimationEnd_II_Z;
9696
#pragma warning disable 0169
9797
static Delegate GetOnAnimationEnd_IIHandler ()
9898
{
99-
if (cb_OnAnimationEnd_II == null)
100-
cb_OnAnimationEnd_II = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPII_Z (n_OnAnimationEnd_II));
101-
return cb_OnAnimationEnd_II;
99+
if (cb_OnAnimationEnd_OnAnimationEnd_II_Z == null)
100+
cb_OnAnimationEnd_OnAnimationEnd_II_Z = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPII_Z (n_OnAnimationEnd_II));
101+
return cb_OnAnimationEnd_OnAnimationEnd_II_Z;
102102
}
103103

104104
static bool n_OnAnimationEnd_II (IntPtr jnienv, IntPtr native__this, int param1, int param2)

tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceRedeclaredDefaultMethod.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ internal partial class IMyInterface2Invoker : global::Java.Lang.Object, IMyInter
6262
JNIEnv.DeleteLocalRef (local_ref);
6363
}
6464

65-
static Delegate cb_DoSomething;
65+
static Delegate cb_DoSomething_DoSomething_V;
6666
#pragma warning disable 0169
6767
static Delegate GetDoSomethingHandler ()
6868
{
69-
if (cb_DoSomething == null)
70-
cb_DoSomething = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_V (n_DoSomething));
71-
return cb_DoSomething;
69+
if (cb_DoSomething_DoSomething_V == null)
70+
cb_DoSomething_DoSomething_V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_V (n_DoSomething));
71+
return cb_DoSomething_DoSomething_V;
7272
}
7373

7474
static void n_DoSomething (IntPtr jnienv, IntPtr native__this)

tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1-NRT/WriteClass.txt

+36-36
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ public partial class MyClass {
4949
}
5050
}
5151

52-
static Delegate? cb_get_Count;
52+
static Delegate? cb_get_Count_get_Count_I;
5353
#pragma warning disable 0169
5454
static Delegate Getget_CountHandler ()
5555
{
56-
if (cb_get_Count == null)
57-
cb_get_Count = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_I (n_get_Count));
58-
return cb_get_Count;
56+
if (cb_get_Count_get_Count_I == null)
57+
cb_get_Count_get_Count_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_I (n_get_Count));
58+
return cb_get_Count_get_Count_I;
5959
}
6060

6161
static int n_get_Count (IntPtr jnienv, IntPtr native__this)
@@ -65,13 +65,13 @@ public partial class MyClass {
6565
}
6666
#pragma warning restore 0169
6767

68-
static Delegate? cb_set_Count_I;
68+
static Delegate? cb_set_Count_set_Count_I_V;
6969
#pragma warning disable 0169
7070
static Delegate Getset_Count_IHandler ()
7171
{
72-
if (cb_set_Count_I == null)
73-
cb_set_Count_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_V (n_set_Count_I));
74-
return cb_set_Count_I;
72+
if (cb_set_Count_set_Count_I_V == null)
73+
cb_set_Count_set_Count_I_V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_V (n_set_Count_I));
74+
return cb_set_Count_set_Count_I_V;
7575
}
7676

7777
static void n_set_Count_I (IntPtr jnienv, IntPtr native__this, int value)
@@ -105,13 +105,13 @@ public partial class MyClass {
105105
}
106106
}
107107

108-
static Delegate? cb_get_Key;
108+
static Delegate? cb_get_Key_get_Key_Ljava_lang_String_;
109109
#pragma warning disable 0169
110110
static Delegate Getget_KeyHandler ()
111111
{
112-
if (cb_get_Key == null)
113-
cb_get_Key = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_get_Key));
114-
return cb_get_Key;
112+
if (cb_get_Key_get_Key_Ljava_lang_String_ == null)
113+
cb_get_Key_get_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_get_Key));
114+
return cb_get_Key_get_Key_Ljava_lang_String_;
115115
}
116116

117117
static IntPtr n_get_Key (IntPtr jnienv, IntPtr native__this)
@@ -121,13 +121,13 @@ public partial class MyClass {
121121
}
122122
#pragma warning restore 0169
123123

124-
static Delegate? cb_set_Key_Ljava_lang_String_;
124+
static Delegate? cb_set_Key_set_Key_Ljava_lang_String__V;
125125
#pragma warning disable 0169
126126
static Delegate Getset_Key_Ljava_lang_String_Handler ()
127127
{
128-
if (cb_set_Key_Ljava_lang_String_ == null)
129-
cb_set_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_V (n_set_Key_Ljava_lang_String_));
130-
return cb_set_Key_Ljava_lang_String_;
128+
if (cb_set_Key_set_Key_Ljava_lang_String__V == null)
129+
cb_set_Key_set_Key_Ljava_lang_String__V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_V (n_set_Key_Ljava_lang_String_));
130+
return cb_set_Key_set_Key_Ljava_lang_String__V;
131131
}
132132

133133
static void n_set_Key_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value)
@@ -188,13 +188,13 @@ public partial class MyClass {
188188
}
189189
}
190190

191-
static Delegate? cb_get_AbstractCount;
191+
static Delegate? cb_get_AbstractCount_get_AbstractCount_I;
192192
#pragma warning disable 0169
193193
static Delegate Getget_AbstractCountHandler ()
194194
{
195-
if (cb_get_AbstractCount == null)
196-
cb_get_AbstractCount = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_I (n_get_AbstractCount));
197-
return cb_get_AbstractCount;
195+
if (cb_get_AbstractCount_get_AbstractCount_I == null)
196+
cb_get_AbstractCount_get_AbstractCount_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_I (n_get_AbstractCount));
197+
return cb_get_AbstractCount_get_AbstractCount_I;
198198
}
199199

200200
static int n_get_AbstractCount (IntPtr jnienv, IntPtr native__this)
@@ -204,13 +204,13 @@ public partial class MyClass {
204204
}
205205
#pragma warning restore 0169
206206

207-
static Delegate? cb_set_AbstractCount_I;
207+
static Delegate? cb_set_AbstractCount_set_AbstractCount_I_V;
208208
#pragma warning disable 0169
209209
static Delegate Getset_AbstractCount_IHandler ()
210210
{
211-
if (cb_set_AbstractCount_I == null)
212-
cb_set_AbstractCount_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_V (n_set_AbstractCount_I));
213-
return cb_set_AbstractCount_I;
211+
if (cb_set_AbstractCount_set_AbstractCount_I_V == null)
212+
cb_set_AbstractCount_set_AbstractCount_I_V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_V (n_set_AbstractCount_I));
213+
return cb_set_AbstractCount_set_AbstractCount_I_V;
214214
}
215215

216216
static void n_set_AbstractCount_I (IntPtr jnienv, IntPtr native__this, int value)
@@ -230,13 +230,13 @@ public partial class MyClass {
230230
set;
231231
}
232232

233-
static Delegate? cb_GetCountForKey_Ljava_lang_String_;
233+
static Delegate? cb_GetCountForKey_GetCountForKey_Ljava_lang_String__I;
234234
#pragma warning disable 0169
235235
static Delegate GetGetCountForKey_Ljava_lang_String_Handler ()
236236
{
237-
if (cb_GetCountForKey_Ljava_lang_String_ == null)
238-
cb_GetCountForKey_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_I (n_GetCountForKey_Ljava_lang_String_));
239-
return cb_GetCountForKey_Ljava_lang_String_;
237+
if (cb_GetCountForKey_GetCountForKey_Ljava_lang_String__I == null)
238+
cb_GetCountForKey_GetCountForKey_Ljava_lang_String__I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_I (n_GetCountForKey_Ljava_lang_String_));
239+
return cb_GetCountForKey_GetCountForKey_Ljava_lang_String__I;
240240
}
241241

242242
static int n_GetCountForKey_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_key)
@@ -264,13 +264,13 @@ public partial class MyClass {
264264
}
265265
}
266266

267-
static Delegate? cb_Key;
267+
static Delegate? cb_Key_Key_Ljava_lang_String_;
268268
#pragma warning disable 0169
269269
static Delegate GetKeyHandler ()
270270
{
271-
if (cb_Key == null)
272-
cb_Key = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_Key));
273-
return cb_Key;
271+
if (cb_Key_Key_Ljava_lang_String_ == null)
272+
cb_Key_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_Key));
273+
return cb_Key_Key_Ljava_lang_String_;
274274
}
275275

276276
static IntPtr n_Key (IntPtr jnienv, IntPtr native__this)
@@ -303,13 +303,13 @@ public partial class MyClass {
303303
}
304304
}
305305

306-
static Delegate? cb_AbstractMethod;
306+
static Delegate? cb_AbstractMethod_AbstractMethod_V;
307307
#pragma warning disable 0169
308308
static Delegate GetAbstractMethodHandler ()
309309
{
310-
if (cb_AbstractMethod == null)
311-
cb_AbstractMethod = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_V (n_AbstractMethod));
312-
return cb_AbstractMethod;
310+
if (cb_AbstractMethod_AbstractMethod_V == null)
311+
cb_AbstractMethod_AbstractMethod_V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_V (n_AbstractMethod));
312+
return cb_AbstractMethod_AbstractMethod_V;
313313
}
314314

315315
static void n_AbstractMethod (IntPtr jnienv, IntPtr native__this)

tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1-NRT/WriteInterface.txt

+36-36
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
130130
JNIEnv.DeleteLocalRef (local_ref);
131131
}
132132

133-
static Delegate? cb_get_Count;
133+
static Delegate? cb_get_Count_get_Count_I;
134134
#pragma warning disable 0169
135135
static Delegate Getget_CountHandler ()
136136
{
137-
if (cb_get_Count == null)
138-
cb_get_Count = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_I (n_get_Count));
139-
return cb_get_Count;
137+
if (cb_get_Count_get_Count_I == null)
138+
cb_get_Count_get_Count_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_I (n_get_Count));
139+
return cb_get_Count_get_Count_I;
140140
}
141141

142142
static int n_get_Count (IntPtr jnienv, IntPtr native__this)
@@ -146,13 +146,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
146146
}
147147
#pragma warning restore 0169
148148

149-
static Delegate? cb_set_Count_I;
149+
static Delegate? cb_set_Count_set_Count_I_V;
150150
#pragma warning disable 0169
151151
static Delegate Getset_Count_IHandler ()
152152
{
153-
if (cb_set_Count_I == null)
154-
cb_set_Count_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_V (n_set_Count_I));
155-
return cb_set_Count_I;
153+
if (cb_set_Count_set_Count_I_V == null)
154+
cb_set_Count_set_Count_I_V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_V (n_set_Count_I));
155+
return cb_set_Count_set_Count_I_V;
156156
}
157157

158158
static void n_set_Count_I (IntPtr jnienv, IntPtr native__this, int value)
@@ -179,13 +179,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
179179
}
180180
}
181181

182-
static Delegate? cb_get_Key;
182+
static Delegate? cb_get_Key_get_Key_Ljava_lang_String_;
183183
#pragma warning disable 0169
184184
static Delegate Getget_KeyHandler ()
185185
{
186-
if (cb_get_Key == null)
187-
cb_get_Key = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_get_Key));
188-
return cb_get_Key;
186+
if (cb_get_Key_get_Key_Ljava_lang_String_ == null)
187+
cb_get_Key_get_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_get_Key));
188+
return cb_get_Key_get_Key_Ljava_lang_String_;
189189
}
190190

191191
static IntPtr n_get_Key (IntPtr jnienv, IntPtr native__this)
@@ -195,13 +195,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
195195
}
196196
#pragma warning restore 0169
197197

198-
static Delegate? cb_set_Key_Ljava_lang_String_;
198+
static Delegate? cb_set_Key_set_Key_Ljava_lang_String__V;
199199
#pragma warning disable 0169
200200
static Delegate Getset_Key_Ljava_lang_String_Handler ()
201201
{
202-
if (cb_set_Key_Ljava_lang_String_ == null)
203-
cb_set_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_V (n_set_Key_Ljava_lang_String_));
204-
return cb_set_Key_Ljava_lang_String_;
202+
if (cb_set_Key_set_Key_Ljava_lang_String__V == null)
203+
cb_set_Key_set_Key_Ljava_lang_String__V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_V (n_set_Key_Ljava_lang_String_));
204+
return cb_set_Key_set_Key_Ljava_lang_String__V;
205205
}
206206

207207
static void n_set_Key_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value)
@@ -231,13 +231,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
231231
}
232232
}
233233

234-
static Delegate? cb_get_AbstractCount;
234+
static Delegate? cb_get_AbstractCount_get_AbstractCount_I;
235235
#pragma warning disable 0169
236236
static Delegate Getget_AbstractCountHandler ()
237237
{
238-
if (cb_get_AbstractCount == null)
239-
cb_get_AbstractCount = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_I (n_get_AbstractCount));
240-
return cb_get_AbstractCount;
238+
if (cb_get_AbstractCount_get_AbstractCount_I == null)
239+
cb_get_AbstractCount_get_AbstractCount_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_I (n_get_AbstractCount));
240+
return cb_get_AbstractCount_get_AbstractCount_I;
241241
}
242242

243243
static int n_get_AbstractCount (IntPtr jnienv, IntPtr native__this)
@@ -247,13 +247,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
247247
}
248248
#pragma warning restore 0169
249249

250-
static Delegate? cb_set_AbstractCount_I;
250+
static Delegate? cb_set_AbstractCount_set_AbstractCount_I_V;
251251
#pragma warning disable 0169
252252
static Delegate Getset_AbstractCount_IHandler ()
253253
{
254-
if (cb_set_AbstractCount_I == null)
255-
cb_set_AbstractCount_I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_V (n_set_AbstractCount_I));
256-
return cb_set_AbstractCount_I;
254+
if (cb_set_AbstractCount_set_AbstractCount_I_V == null)
255+
cb_set_AbstractCount_set_AbstractCount_I_V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPI_V (n_set_AbstractCount_I));
256+
return cb_set_AbstractCount_set_AbstractCount_I_V;
257257
}
258258

259259
static void n_set_AbstractCount_I (IntPtr jnienv, IntPtr native__this, int value)
@@ -280,13 +280,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
280280
}
281281
}
282282

283-
static Delegate? cb_GetCountForKey_Ljava_lang_String_;
283+
static Delegate? cb_GetCountForKey_GetCountForKey_Ljava_lang_String__I;
284284
#pragma warning disable 0169
285285
static Delegate GetGetCountForKey_Ljava_lang_String_Handler ()
286286
{
287-
if (cb_GetCountForKey_Ljava_lang_String_ == null)
288-
cb_GetCountForKey_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_I (n_GetCountForKey_Ljava_lang_String_));
289-
return cb_GetCountForKey_Ljava_lang_String_;
287+
if (cb_GetCountForKey_GetCountForKey_Ljava_lang_String__I == null)
288+
cb_GetCountForKey_GetCountForKey_Ljava_lang_String__I = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_I (n_GetCountForKey_Ljava_lang_String_));
289+
return cb_GetCountForKey_GetCountForKey_Ljava_lang_String__I;
290290
}
291291

292292
static int n_GetCountForKey_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_key)
@@ -311,13 +311,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
311311
return __ret;
312312
}
313313

314-
static Delegate? cb_Key;
314+
static Delegate? cb_Key_Key_Ljava_lang_String_;
315315
#pragma warning disable 0169
316316
static Delegate GetKeyHandler ()
317317
{
318-
if (cb_Key == null)
319-
cb_Key = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_Key));
320-
return cb_Key;
318+
if (cb_Key_Key_Ljava_lang_String_ == null)
319+
cb_Key_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_Key));
320+
return cb_Key_Key_Ljava_lang_String_;
321321
}
322322

323323
static IntPtr n_Key (IntPtr jnienv, IntPtr native__this)
@@ -335,13 +335,13 @@ internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterf
335335
return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_Key), JniHandleOwnership.TransferLocalRef);
336336
}
337337

338-
static Delegate? cb_AbstractMethod;
338+
static Delegate? cb_AbstractMethod_AbstractMethod_V;
339339
#pragma warning disable 0169
340340
static Delegate GetAbstractMethodHandler ()
341341
{
342-
if (cb_AbstractMethod == null)
343-
cb_AbstractMethod = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_V (n_AbstractMethod));
344-
return cb_AbstractMethod;
342+
if (cb_AbstractMethod_AbstractMethod_V == null)
343+
cb_AbstractMethod_AbstractMethod_V = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_V (n_AbstractMethod));
344+
return cb_AbstractMethod_AbstractMethod_V;
345345
}
346346

347347
static void n_AbstractMethod (IntPtr jnienv, IntPtr native__this)

tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1-NRT/WriteMethodWithCharSequenceArrays.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ public partial class MyClass : Java.Lang.Object {
2929
{
3030
}
3131

32-
static Delegate? cb_echo_arrayLjava_lang_CharSequence_;
32+
static Delegate? cb_echo_Echo_arrayLjava_lang_CharSequence__arrayLjava_lang_CharSequence_;
3333
#pragma warning disable 0169
3434
static Delegate GetEcho_arrayLjava_lang_CharSequence_Handler ()
3535
{
36-
if (cb_echo_arrayLjava_lang_CharSequence_ == null)
37-
cb_echo_arrayLjava_lang_CharSequence_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_L (n_Echo_arrayLjava_lang_CharSequence_));
38-
return cb_echo_arrayLjava_lang_CharSequence_;
36+
if (cb_echo_Echo_arrayLjava_lang_CharSequence__arrayLjava_lang_CharSequence_ == null)
37+
cb_echo_Echo_arrayLjava_lang_CharSequence__arrayLjava_lang_CharSequence_ = JNINativeWrapper.CreateDelegate (new _JniMarshal_PPL_L (n_Echo_arrayLjava_lang_CharSequence_));
38+
return cb_echo_Echo_arrayLjava_lang_CharSequence__arrayLjava_lang_CharSequence_;
3939
}
4040

4141
static IntPtr n_Echo_arrayLjava_lang_CharSequence_ (IntPtr jnienv, IntPtr native__this, IntPtr native_messages)

0 commit comments

Comments
 (0)