Skip to content

Commit ea1ae1a

Browse files
committed
[Java.Interop] Rename *ID types to *Info types.
Fixes: #22 Rename JniFieldID to JniFieldInfo. Rename JniInstanceFieldID to JniInstanceFieldInfo. Rename JniStaticFieldID to JniStaticFieldInfo. Rename JniMethodID to JniMethodInfo. Rename JniInstanceMethodID to JniInstanceMethodInfo. Rename JniStaticMethodID to JniStaticMethodInfo. Why? As of commit 25de1f3, these types are no longer SafeHandle subclasses. Instead, they contain an property which is the underlying JNI ID to use for JNI invocation purposes. Meaning these types are NOT IDs. They *hold* IDs. They also contain a variety of helper methods and forwarders to JniEnvironment.InstanceFields/etc. types. They are thus less "identifier" types and more "informational" types. Hence the replacing of the "ID" suffix with "Info".
1 parent c2a6d5e commit ea1ae1a

File tree

21 files changed

+113
-113
lines changed

21 files changed

+113
-113
lines changed

src/Java.Interop.Dynamic/Java.Interop.Dynamic/JavaClassInfo.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ class JavaClassInfo : IDisposable {
1919

2020
static readonly Func<string, Type, JniPeerMembers> CreatePeerMembers;
2121

22-
static readonly JniInstanceMethodID Class_getConstructors;
23-
static readonly JniInstanceMethodID Class_getFields;
24-
static readonly JniInstanceMethodID Class_getMethods;
22+
static readonly JniInstanceMethodInfo Class_getConstructors;
23+
static readonly JniInstanceMethodInfo Class_getFields;
24+
static readonly JniInstanceMethodInfo Class_getMethods;
2525

26-
static readonly JniInstanceMethodID Constructor_getParameterTypes;
26+
static readonly JniInstanceMethodInfo Constructor_getParameterTypes;
2727

28-
static readonly JniInstanceMethodID Field_getName;
29-
static readonly JniInstanceMethodID Field_getType;
28+
static readonly JniInstanceMethodInfo Field_getName;
29+
static readonly JniInstanceMethodInfo Field_getType;
3030

31-
static readonly JniInstanceMethodID Method_getName;
32-
static readonly JniInstanceMethodID Method_getReturnType;
33-
static readonly JniInstanceMethodID Method_getParameterTypes;
31+
static readonly JniInstanceMethodInfo Method_getName;
32+
static readonly JniInstanceMethodInfo Method_getReturnType;
33+
static readonly JniInstanceMethodInfo Method_getParameterTypes;
3434

35-
static readonly JniInstanceMethodID Member_getModifiers;
35+
static readonly JniInstanceMethodInfo Member_getModifiers;
3636

3737
static readonly Dictionary<string, WeakReference> Classes = new Dictionary<string, WeakReference> ();
3838

src/Java.Interop/Java.Interop.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@
4040
<Compile Include="Java.Interop\JavaVM.cs" />
4141
<Compile Include="Java.Interop\JniAllocObjectRef.cs" />
4242
<Compile Include="Java.Interop\JniReferenceSafeHandle.cs" />
43-
<Compile Include="Java.Interop\JniInstanceMethodID.cs" />
4443
<Compile Include="Java.Interop\JniEnvironment.cs" />
4544
<Compile Include="Java.Interop\JniEnvironment.g.cs" />
4645
<Compile Include="Java.Interop\JniEnvironment.References.cs" />
4746
<Compile Include="Java.Interop\JniEnvironment.Strings.cs" />
4847
<Compile Include="Java.Interop\JniEnvironment.Types.cs" />
49-
<Compile Include="Java.Interop\JniPeerMembers.cs" />
48+
<Compile Include="Java.Interop\JniFieldInfo.cs" />
5049
<Compile Include="Java.Interop\JniHandleManager.cs" />
50+
<Compile Include="Java.Interop\JniInstanceFieldInfo.cs" />
51+
<Compile Include="Java.Interop\JniInstanceMethodInfo.cs" />
52+
<Compile Include="Java.Interop\JniMethodInfo.cs" />
53+
<Compile Include="Java.Interop\JniPeerMembers.cs" />
54+
<Compile Include="Java.Interop\JniStaticMethodInfo.cs" />
55+
<Compile Include="Java.Interop\JniStaticFieldInfo.cs" />
5156
<Compile Include="Java.Interop\JniType.cs" />
5257
<Compile Include="Java.Interop\JValue.cs" />
53-
<Compile Include="Java.Interop\JniInstanceFieldID.cs" />
54-
<Compile Include="Java.Interop\JniStaticFieldID.cs" />
55-
<Compile Include="Java.Interop\JniStaticMethodID.cs" />
5658
<Compile Include="Java.Interop\JniGlobalReference.cs" />
5759
<Compile Include="Java.Interop\JniWeakGlobalReference.cs" />
5860
<Compile Include="Java.Interop\JniLocalReference.cs" />
5961
<Compile Include="Java.Interop\JavaException.cs" />
6062
<Compile Include="Java.Interop\JniHandleOwnership.cs" />
6163
<Compile Include="Java.Interop\JniNativeMethodRegistration.cs" />
62-
<Compile Include="Java.Interop\JniFieldID.cs" />
63-
<Compile Include="Java.Interop\JniMethodID.cs" />
6464
<Compile Include="Java.Interop\JavaObject.cs" />
6565
<Compile Include="Java.Interop\JniSystem.cs" />
6666
<Compile Include="Java.Interop\JavaArray.cs" />

src/Java.Interop/Java.Interop/JniBuiltinMarshalers.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ internal static JValue CreateJValue (object value)
9191
return new JValue ((Boolean) value);
9292
}
9393

94-
static JniInstanceMethodID init;
94+
static JniInstanceMethodInfo init;
9595
internal static unsafe JniObjectReference CreateLocalRef (object value)
9696
{
9797
Debug.Assert (value is Boolean, "Expected value of type `Boolean`; was: " + (value == null ? "<null>" : value.GetType ().FullName));
@@ -103,7 +103,7 @@ internal static unsafe JniObjectReference CreateLocalRef (object value)
103103
return TypeRef.NewObject (init, args);
104104
}
105105

106-
static JniInstanceMethodID booleanValue;
106+
static JniInstanceMethodInfo booleanValue;
107107
internal static object GetValueFromJni (ref JniObjectReference self, JniHandleOwnership transfer, Type targetType)
108108
{
109109
Debug.Assert (targetType == null || targetType == typeof (Boolean), "Expected targetType==typeof(Boolean); was: " + targetType);
@@ -129,7 +129,7 @@ internal static JValue CreateJValue (object value)
129129
return new JValue ((SByte) value);
130130
}
131131

132-
static JniInstanceMethodID init;
132+
static JniInstanceMethodInfo init;
133133
internal static unsafe JniObjectReference CreateLocalRef (object value)
134134
{
135135
Debug.Assert (value is SByte, "Expected value of type `SByte`; was: " + (value == null ? "<null>" : value.GetType ().FullName));
@@ -141,7 +141,7 @@ internal static unsafe JniObjectReference CreateLocalRef (object value)
141141
return TypeRef.NewObject (init, args);
142142
}
143143

144-
static JniInstanceMethodID byteValue;
144+
static JniInstanceMethodInfo byteValue;
145145
internal static object GetValueFromJni (ref JniObjectReference self, JniHandleOwnership transfer, Type targetType)
146146
{
147147
Debug.Assert (targetType == null || targetType == typeof (SByte), "Expected targetType==typeof(SByte); was: " + targetType);
@@ -167,7 +167,7 @@ internal static JValue CreateJValue (object value)
167167
return new JValue ((Char) value);
168168
}
169169

170-
static JniInstanceMethodID init;
170+
static JniInstanceMethodInfo init;
171171
internal static unsafe JniObjectReference CreateLocalRef (object value)
172172
{
173173
Debug.Assert (value is Char, "Expected value of type `Char`; was: " + (value == null ? "<null>" : value.GetType ().FullName));
@@ -179,7 +179,7 @@ internal static unsafe JniObjectReference CreateLocalRef (object value)
179179
return TypeRef.NewObject (init, args);
180180
}
181181

182-
static JniInstanceMethodID charValue;
182+
static JniInstanceMethodInfo charValue;
183183
internal static object GetValueFromJni (ref JniObjectReference self, JniHandleOwnership transfer, Type targetType)
184184
{
185185
Debug.Assert (targetType == null || targetType == typeof (Char), "Expected targetType==typeof(Char); was: " + targetType);
@@ -205,7 +205,7 @@ internal static JValue CreateJValue (object value)
205205
return new JValue ((Int16) value);
206206
}
207207

208-
static JniInstanceMethodID init;
208+
static JniInstanceMethodInfo init;
209209
internal static unsafe JniObjectReference CreateLocalRef (object value)
210210
{
211211
Debug.Assert (value is Int16, "Expected value of type `Int16`; was: " + (value == null ? "<null>" : value.GetType ().FullName));
@@ -217,7 +217,7 @@ internal static unsafe JniObjectReference CreateLocalRef (object value)
217217
return TypeRef.NewObject (init, args);
218218
}
219219

220-
static JniInstanceMethodID shortValue;
220+
static JniInstanceMethodInfo shortValue;
221221
internal static object GetValueFromJni (ref JniObjectReference self, JniHandleOwnership transfer, Type targetType)
222222
{
223223
Debug.Assert (targetType == null || targetType == typeof (Int16), "Expected targetType==typeof(Int16); was: " + targetType);
@@ -243,7 +243,7 @@ internal static JValue CreateJValue (object value)
243243
return new JValue ((Int32) value);
244244
}
245245

246-
static JniInstanceMethodID init;
246+
static JniInstanceMethodInfo init;
247247
internal static unsafe JniObjectReference CreateLocalRef (object value)
248248
{
249249
Debug.Assert (value is Int32, "Expected value of type `Int32`; was: " + (value == null ? "<null>" : value.GetType ().FullName));
@@ -255,7 +255,7 @@ internal static unsafe JniObjectReference CreateLocalRef (object value)
255255
return TypeRef.NewObject (init, args);
256256
}
257257

258-
static JniInstanceMethodID intValue;
258+
static JniInstanceMethodInfo intValue;
259259
internal static object GetValueFromJni (ref JniObjectReference self, JniHandleOwnership transfer, Type targetType)
260260
{
261261
Debug.Assert (targetType == null || targetType == typeof (Int32), "Expected targetType==typeof(Int32); was: " + targetType);
@@ -281,7 +281,7 @@ internal static JValue CreateJValue (object value)
281281
return new JValue ((Int64) value);
282282
}
283283

284-
static JniInstanceMethodID init;
284+
static JniInstanceMethodInfo init;
285285
internal static unsafe JniObjectReference CreateLocalRef (object value)
286286
{
287287
Debug.Assert (value is Int64, "Expected value of type `Int64`; was: " + (value == null ? "<null>" : value.GetType ().FullName));
@@ -293,7 +293,7 @@ internal static unsafe JniObjectReference CreateLocalRef (object value)
293293
return TypeRef.NewObject (init, args);
294294
}
295295

296-
static JniInstanceMethodID longValue;
296+
static JniInstanceMethodInfo longValue;
297297
internal static object GetValueFromJni (ref JniObjectReference self, JniHandleOwnership transfer, Type targetType)
298298
{
299299
Debug.Assert (targetType == null || targetType == typeof (Int64), "Expected targetType==typeof(Int64); was: " + targetType);
@@ -319,7 +319,7 @@ internal static JValue CreateJValue (object value)
319319
return new JValue ((Single) value);
320320
}
321321

322-
static JniInstanceMethodID init;
322+
static JniInstanceMethodInfo init;
323323
internal static unsafe JniObjectReference CreateLocalRef (object value)
324324
{
325325
Debug.Assert (value is Single, "Expected value of type `Single`; was: " + (value == null ? "<null>" : value.GetType ().FullName));
@@ -331,7 +331,7 @@ internal static unsafe JniObjectReference CreateLocalRef (object value)
331331
return TypeRef.NewObject (init, args);
332332
}
333333

334-
static JniInstanceMethodID floatValue;
334+
static JniInstanceMethodInfo floatValue;
335335
internal static object GetValueFromJni (ref JniObjectReference self, JniHandleOwnership transfer, Type targetType)
336336
{
337337
Debug.Assert (targetType == null || targetType == typeof (Single), "Expected targetType==typeof(Single); was: " + targetType);
@@ -357,7 +357,7 @@ internal static JValue CreateJValue (object value)
357357
return new JValue ((Double) value);
358358
}
359359

360-
static JniInstanceMethodID init;
360+
static JniInstanceMethodInfo init;
361361
internal static unsafe JniObjectReference CreateLocalRef (object value)
362362
{
363363
Debug.Assert (value is Double, "Expected value of type `Double`; was: " + (value == null ? "<null>" : value.GetType ().FullName));
@@ -369,7 +369,7 @@ internal static unsafe JniObjectReference CreateLocalRef (object value)
369369
return TypeRef.NewObject (init, args);
370370
}
371371

372-
static JniInstanceMethodID doubleValue;
372+
static JniInstanceMethodInfo doubleValue;
373373
internal static object GetValueFromJni (ref JniObjectReference self, JniHandleOwnership transfer, Type targetType)
374374
{
375375
Debug.Assert (targetType == null || targetType == typeof (Double), "Expected targetType==typeof(Double); was: " + targetType);

src/Java.Interop/Java.Interop/JniEnvironment.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ internal void DeleteLocalReference (JniLocalReference value, IntPtr handle)
214214
}
215215
#endif // FEATURE_HANDLES_ARE_SAFE_HANDLES
216216

217-
JniInstanceMethodID Obj_toS;
218-
internal JniInstanceMethodID Object_toString {
217+
JniInstanceMethodInfo Obj_toS;
218+
internal JniInstanceMethodInfo Object_toString {
219219
get {
220220
if (Obj_toS != null)
221221
return Obj_toS;
@@ -227,8 +227,8 @@ internal JniInstanceMethodID Object_toString {
227227
}
228228
}
229229

230-
JniInstanceMethodID Cls_getN;
231-
internal JniInstanceMethodID Class_getName {
230+
JniInstanceMethodInfo Cls_getN;
231+
internal JniInstanceMethodInfo Class_getName {
232232
get {
233233
if (Cls_getN != null)
234234
return Cls_getN;

src/Java.Interop/Java.Interop/JniFieldID.cs renamed to src/Java.Interop/Java.Interop/JniFieldInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace Java.Interop
44
{
5-
public abstract class JniFieldID
5+
public abstract class JniFieldInfo
66
{
77
public IntPtr ID {get; private set;}
88

99
internal bool IsValid {
1010
get {return ID != IntPtr.Zero;}
1111
}
1212

13-
internal JniFieldID (IntPtr fieldID)
13+
internal JniFieldInfo (IntPtr fieldID)
1414
{
1515
ID = fieldID;
1616
}

src/Java.Interop/Java.Interop/JniInstanceFieldID.cs renamed to src/Java.Interop/Java.Interop/JniInstanceFieldInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
namespace Java.Interop
55
{
6-
public sealed class JniInstanceFieldID : JniFieldID
6+
public sealed class JniInstanceFieldInfo : JniFieldInfo
77
{
8-
internal JniInstanceFieldID (IntPtr fieldID)
8+
internal JniInstanceFieldInfo (IntPtr fieldID)
99
: base (fieldID)
1010
{
1111
}

src/Java.Interop/Java.Interop/JniInstanceMethodID.cs renamed to src/Java.Interop/Java.Interop/JniInstanceMethodInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
namespace Java.Interop
55
{
6-
public sealed class JniInstanceMethodID : JniMethodID
6+
public sealed class JniInstanceMethodInfo : JniMethodInfo
77
{
8-
internal JniInstanceMethodID (IntPtr methodID)
8+
internal JniInstanceMethodInfo (IntPtr methodID)
99
: base (methodID)
1010
{
1111
}

src/Java.Interop/Java.Interop/JniMethodID.cs renamed to src/Java.Interop/Java.Interop/JniMethodInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
namespace Java.Interop
55
{
6-
public abstract class JniMethodID
6+
public abstract class JniMethodInfo
77
{
88
public IntPtr ID {get; private set;}
99

1010
internal bool IsValid {
1111
get {return ID != IntPtr.Zero;}
1212
}
1313

14-
internal JniMethodID (IntPtr methodID)
14+
internal JniMethodInfo (IntPtr methodID)
1515
{
1616
ID = methodID;
1717
}

src/Java.Interop/Java.Interop/JniPeerInstanceFields.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal JniPeerInstanceFields (JniPeerMembers members)
1212

1313
readonly JniPeerMembers Members;
1414

15-
Dictionary<string, JniInstanceFieldID> InstanceFields = new Dictionary<string, JniInstanceFieldID>();
15+
Dictionary<string, JniInstanceFieldInfo> InstanceFields = new Dictionary<string, JniInstanceFieldInfo>();
1616

1717
internal void Dispose ()
1818
{
@@ -22,10 +22,10 @@ internal void Dispose ()
2222
InstanceFields = null;
2323
}
2424

25-
public JniInstanceFieldID GetFieldID (string encodedMember)
25+
public JniInstanceFieldInfo GetFieldID (string encodedMember)
2626
{
2727
lock (InstanceFields) {
28-
JniInstanceFieldID f;
28+
JniInstanceFieldInfo f;
2929
if (!InstanceFields.TryGetValue (encodedMember, out f)) {
3030
string field, signature;
3131
JniPeerMembers.GetNameAndSignature (encodedMember, out field, out signature);

src/Java.Interop/Java.Interop/JniPeerInstanceMethods.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal JniPeerInstanceMethods (JniPeerMembers members)
2929

3030
readonly Type DeclaringType;
3131

32-
Dictionary<string, JniInstanceMethodID> InstanceMethods = new Dictionary<string, JniInstanceMethodID>();
32+
Dictionary<string, JniInstanceMethodInfo> InstanceMethods = new Dictionary<string, JniInstanceMethodInfo>();
3333
Dictionary<Type, JniPeerInstanceMethods> SubclassConstructors = new Dictionary<Type, JniPeerInstanceMethods> ();
3434

3535
internal void Dispose ()
@@ -47,12 +47,12 @@ internal void Dispose ()
4747
JniPeerType = null;
4848
}
4949

50-
public JniInstanceMethodID GetConstructor (string signature)
50+
public JniInstanceMethodInfo GetConstructor (string signature)
5151
{
5252
if (signature == null)
5353
throw new ArgumentNullException ("signature");
5454
lock (InstanceMethods) {
55-
JniInstanceMethodID m;
55+
JniInstanceMethodInfo m;
5656
if (!InstanceMethods.TryGetValue (signature, out m)) {
5757
m = JniPeerType.GetConstructor (signature);
5858
InstanceMethods.Add (signature, m);
@@ -76,10 +76,10 @@ internal JniPeerInstanceMethods GetConstructorsForType (Type declaringType)
7676
return methods;
7777
}
7878

79-
public JniInstanceMethodID GetMethodID (string encodedMember)
79+
public JniInstanceMethodInfo GetMethodID (string encodedMember)
8080
{
8181
lock (InstanceMethods) {
82-
JniInstanceMethodID m;
82+
JniInstanceMethodInfo m;
8383
if (!InstanceMethods.TryGetValue (encodedMember, out m)) {
8484
string method, signature;
8585
JniPeerMembers.GetNameAndSignature (encodedMember, out method, out signature);

0 commit comments

Comments
 (0)