Skip to content

Commit cd66502

Browse files
committed
fix: avoid type parameter name conflict in generated Unity C# code
1 parent 672a9b5 commit cd66502

File tree

6 files changed

+118
-118
lines changed

6 files changed

+118
-118
lines changed

Runtime/Java/Util/AbstractMap.cs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Java.Util
66
{
77
public static class AbstractMap
88
{
9-
public class SimpleEntry<K, V> : global::Google.LibraryWrapper.Java.JavaObject, global::Java.Util.Map.Entry<K, V>, global::Java.ExternalType.Java.Io.Serializable where K : class where V : class
9+
public class SimpleEntry<K2, V2> : global::Google.LibraryWrapper.Java.JavaObject, global::Java.Util.Map.Entry<K2, V2>, global::Java.ExternalType.Java.Io.Serializable where K2 : class where V2 : class
1010
{
1111
private static readonly IntPtr _classObject;
1212
private static readonly IntPtr _cachedConstructorId0;
@@ -32,7 +32,7 @@ static SimpleEntry()
3232
_cachedMethodId4 = AndroidJNI.GetMethodID(_classObject, "hashCode", "()I");
3333
}
3434

35-
public SimpleEntry(K key, V value) : base(IntPtr.Zero)
35+
public SimpleEntry(K2 key, V2 value) : base(IntPtr.Zero)
3636
{
3737
try
3838
{
@@ -47,7 +47,7 @@ public SimpleEntry(K key, V value) : base(IntPtr.Zero)
4747
}
4848
}
4949

50-
public SimpleEntry(global::Java.Util.Map.Entry<K, V> entry) : base(IntPtr.Zero)
50+
public SimpleEntry(global::Java.Util.Map.Entry<K2, V2> entry) : base(IntPtr.Zero)
5151
{
5252
try
5353
{
@@ -84,20 +84,20 @@ public SimpleEntry(IntPtr rawObject) : base(IntPtr.Zero)
8484
}
8585
}
8686

87-
public K GetKey()
87+
public K2 GetKey()
8888
{
8989
try
9090
{
9191
AndroidJNI.PushLocalFrame(0);
9292
jvalue[] args_ = new jvalue[] {};
93-
if (typeof(K) == typeof(global::System.String))
93+
if (typeof(K2) == typeof(global::System.String))
9494
{
95-
return (K) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId0, args_);
95+
return (K2) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId0, args_);
9696
}
9797
else
9898
{
9999
IntPtr result_ = AndroidJNI.CallObjectMethod(_rawObject, _cachedMethodId0, args_);
100-
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<K>(result_);
100+
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<K2>(result_);
101101
}
102102
}
103103
finally
@@ -106,20 +106,20 @@ public K GetKey()
106106
}
107107
}
108108

109-
public V GetValue()
109+
public V2 GetValue()
110110
{
111111
try
112112
{
113113
AndroidJNI.PushLocalFrame(0);
114114
jvalue[] args_ = new jvalue[] {};
115-
if (typeof(V) == typeof(global::System.String))
115+
if (typeof(V2) == typeof(global::System.String))
116116
{
117-
return (V) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId1, args_);
117+
return (V2) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId1, args_);
118118
}
119119
else
120120
{
121121
IntPtr result_ = AndroidJNI.CallObjectMethod(_rawObject, _cachedMethodId1, args_);
122-
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<V>(result_);
122+
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<V2>(result_);
123123
}
124124
}
125125
finally
@@ -128,20 +128,20 @@ public V GetValue()
128128
}
129129
}
130130

131-
public V SetValue(V value)
131+
public V2 SetValue(V2 value)
132132
{
133133
try
134134
{
135135
AndroidJNI.PushLocalFrame(0);
136136
jvalue[] args_ = new jvalue[] {ToJvalue(value)};
137-
if (typeof(V) == typeof(global::System.String))
137+
if (typeof(V2) == typeof(global::System.String))
138138
{
139-
return (V) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId2, args_);
139+
return (V2) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId2, args_);
140140
}
141141
else
142142
{
143143
IntPtr result_ = AndroidJNI.CallObjectMethod(_rawObject, _cachedMethodId2, args_);
144-
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<V>(result_);
144+
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<V2>(result_);
145145
}
146146
}
147147
finally
@@ -178,14 +178,14 @@ public int HashCode()
178178
}
179179
}
180180

181-
public static explicit operator IntPtr(SimpleEntry<K, V> wrapper)
181+
public static explicit operator IntPtr(SimpleEntry<K2, V2> wrapper)
182182
{
183183
return wrapper.GetRawObject();
184184
}
185185

186-
public static explicit operator SimpleEntry<K, V>(IntPtr rawObject)
186+
public static explicit operator SimpleEntry<K2, V2>(IntPtr rawObject)
187187
{
188-
return new SimpleEntry<K, V>(rawObject);
188+
return new SimpleEntry<K2, V2>(rawObject);
189189
}
190190

191191
public new static IntPtr GetRawClass()
@@ -194,7 +194,7 @@ public static explicit operator SimpleEntry<K, V>(IntPtr rawObject)
194194
}
195195
} // end class SimpleEntry
196196

197-
public class SimpleImmutableEntry<K, V> : global::Google.LibraryWrapper.Java.JavaObject, global::Java.Util.Map.Entry<K, V>, global::Java.ExternalType.Java.Io.Serializable where K : class where V : class
197+
public class SimpleImmutableEntry<K2, V2> : global::Google.LibraryWrapper.Java.JavaObject, global::Java.Util.Map.Entry<K2, V2>, global::Java.ExternalType.Java.Io.Serializable where K2 : class where V2 : class
198198
{
199199
private static readonly IntPtr _classObject;
200200
private static readonly IntPtr _cachedConstructorId0;
@@ -220,7 +220,7 @@ static SimpleImmutableEntry()
220220
_cachedMethodId4 = AndroidJNI.GetMethodID(_classObject, "hashCode", "()I");
221221
}
222222

223-
public SimpleImmutableEntry(K key, V value) : base(IntPtr.Zero)
223+
public SimpleImmutableEntry(K2 key, V2 value) : base(IntPtr.Zero)
224224
{
225225
try
226226
{
@@ -235,7 +235,7 @@ public SimpleImmutableEntry(K key, V value) : base(IntPtr.Zero)
235235
}
236236
}
237237

238-
public SimpleImmutableEntry(global::Java.Util.Map.Entry<K, V> entry) : base(IntPtr.Zero)
238+
public SimpleImmutableEntry(global::Java.Util.Map.Entry<K2, V2> entry) : base(IntPtr.Zero)
239239
{
240240
try
241241
{
@@ -272,20 +272,20 @@ public SimpleImmutableEntry(IntPtr rawObject) : base(IntPtr.Zero)
272272
}
273273
}
274274

275-
public K GetKey()
275+
public K2 GetKey()
276276
{
277277
try
278278
{
279279
AndroidJNI.PushLocalFrame(0);
280280
jvalue[] args_ = new jvalue[] {};
281-
if (typeof(K) == typeof(global::System.String))
281+
if (typeof(K2) == typeof(global::System.String))
282282
{
283-
return (K) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId0, args_);
283+
return (K2) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId0, args_);
284284
}
285285
else
286286
{
287287
IntPtr result_ = AndroidJNI.CallObjectMethod(_rawObject, _cachedMethodId0, args_);
288-
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<K>(result_);
288+
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<K2>(result_);
289289
}
290290
}
291291
finally
@@ -294,20 +294,20 @@ public K GetKey()
294294
}
295295
}
296296

297-
public V GetValue()
297+
public V2 GetValue()
298298
{
299299
try
300300
{
301301
AndroidJNI.PushLocalFrame(0);
302302
jvalue[] args_ = new jvalue[] {};
303-
if (typeof(V) == typeof(global::System.String))
303+
if (typeof(V2) == typeof(global::System.String))
304304
{
305-
return (V) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId1, args_);
305+
return (V2) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId1, args_);
306306
}
307307
else
308308
{
309309
IntPtr result_ = AndroidJNI.CallObjectMethod(_rawObject, _cachedMethodId1, args_);
310-
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<V>(result_);
310+
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<V2>(result_);
311311
}
312312
}
313313
finally
@@ -316,20 +316,20 @@ public V GetValue()
316316
}
317317
}
318318

319-
public V SetValue(V value)
319+
public V2 SetValue(V2 value)
320320
{
321321
try
322322
{
323323
AndroidJNI.PushLocalFrame(0);
324324
jvalue[] args_ = new jvalue[] {ToJvalue(value)};
325-
if (typeof(V) == typeof(global::System.String))
325+
if (typeof(V2) == typeof(global::System.String))
326326
{
327-
return (V) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId2, args_);
327+
return (V2) (global::System.Object) AndroidJNI.CallStringMethod(_rawObject, _cachedMethodId2, args_);
328328
}
329329
else
330330
{
331331
IntPtr result_ = AndroidJNI.CallObjectMethod(_rawObject, _cachedMethodId2, args_);
332-
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<V>(result_);
332+
return Google.LibraryWrapper.Java.Utils.CreateGenericInstance<V2>(result_);
333333
}
334334
}
335335
finally
@@ -366,14 +366,14 @@ public int HashCode()
366366
}
367367
}
368368

369-
public static explicit operator IntPtr(SimpleImmutableEntry<K, V> wrapper)
369+
public static explicit operator IntPtr(SimpleImmutableEntry<K2, V2> wrapper)
370370
{
371371
return wrapper.GetRawObject();
372372
}
373373

374-
public static explicit operator SimpleImmutableEntry<K, V>(IntPtr rawObject)
374+
public static explicit operator SimpleImmutableEntry<K2, V2>(IntPtr rawObject)
375375
{
376-
return new SimpleImmutableEntry<K, V>(rawObject);
376+
return new SimpleImmutableEntry<K2, V2>(rawObject);
377377
}
378378

379379
public new static IntPtr GetRawClass()

0 commit comments

Comments
 (0)