Skip to content

Commit 33ebcb8

Browse files
committed
[Java.Interop] Rename IJniHandleManager to IJniObjectReferenceManager
Fixes: #20 "Handles" are out; "References" are in. See 25de1f3. Also rename JniHandleManager to JniObjectReferenceManager.
1 parent 05122d1 commit 33ebcb8

File tree

10 files changed

+20
-19
lines changed

10 files changed

+20
-19
lines changed

src/Android.Interop/Android.Interop.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
<ItemGroup>
4747
<Compile Include="Resources\Resource.designer.cs" />
4848
<Compile Include="Java.Interop\AndroidVM.cs" />
49-
<Compile Include="..\Java.Interop\Tests\Java.Interop\LoggingJniHandleManagerDecorator.cs">
50-
<Link>LoggingJniHandleManagerDecorator.cs</Link>
49+
<Compile Include="..\Java.Interop\Tests\Java.Interop\LoggingJniObjectReferenceManagerDecorator.cs">
50+
<Link>LoggingJniObjectReferenceManagerDecorator.cs</Link>
5151
</Compile>
5252
</ItemGroup>
5353
<ItemGroup>

src/Android.Interop/Java.Interop/AndroidVM.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public AndroidVMBuilder ()
2222
throw new InvalidOperationException ("JNIEnv::GetJavaVM() returned: " + r);
2323
InvocationPointer = vm;
2424
}
25-
JniHandleManager = Java.InteropTests.LoggingJniHandleManagerDecorator.GetHandleManager (new JniHandleManager ());
25+
JniHandleManager = Java.InteropTests.LoggingJniObjectReferenceManagerDecorator.GetObjectReferenceManager (new JniObjectReferenceManager ());
2626
}
2727

2828
public AndroidVM CreateAndroidVM ()

src/Java.Interop/Java.Interop.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
</PropertyGroup>
3636
<ItemGroup>
3737
<Compile Include="Properties\AssemblyInfo.cs" />
38-
<Compile Include="Java.Interop\IJniHandleManager.cs" />
3938
<Compile Include="Java.Interop\JavaPeerableExtensions.cs" />
4039
<Compile Include="Java.Interop\JavaVM.cs" />
4140
<Compile Include="Java.Interop\JniAllocObjectRef.cs" />
@@ -46,7 +45,6 @@
4645
<Compile Include="Java.Interop\JniEnvironment.Strings.cs" />
4746
<Compile Include="Java.Interop\JniEnvironment.Types.cs" />
4847
<Compile Include="Java.Interop\JniFieldInfo.cs" />
49-
<Compile Include="Java.Interop\JniHandleManager.cs" />
5048
<Compile Include="Java.Interop\JniInstanceFieldInfo.cs" />
5149
<Compile Include="Java.Interop\JniInstanceMethodInfo.cs" />
5250
<Compile Include="Java.Interop\JniMethodInfo.cs" />
@@ -67,13 +65,15 @@
6765
<Compile Include="Java.Interop\IExportedMemberBuilder.cs" />
6866
<Compile Include="Java.Interop\IJavaPeerable.cs" />
6967
<Compile Include="Java.Interop\IJavaPeerableEx.cs" />
68+
<Compile Include="Java.Interop\IJniObjectReferenceManager.cs" />
7069
<Compile Include="Java.Interop\JavaObjectArray.cs" />
7170
<Compile Include="Java.Interop\JniTypeInfoAttribute.cs" />
7271
<Compile Include="Java.Interop\JniTypeInfo.cs" />
7372
<Compile Include="Java.Interop\JavaProxyObject.cs" />
7473
<Compile Include="Java.Interop\JniMarshal.cs" />
7574
<Compile Include="Java.Interop\JniMarshalInfo.cs" />
7675
<Compile Include="Java.Interop\JniObjectReference.cs" />
76+
<Compile Include="Java.Interop\JniObjectReferenceManager.cs" />
7777
<Compile Include="Java.Interop\JniObjectReferenceType.cs" />
7878
<Compile Include="Java.Interop\JniPeerInstanceMethods.cs" />
7979
<Compile Include="Java.Interop\JniPeerInstanceFields.cs" />

src/Java.Interop/Java.Interop/IJniHandleManager.cs renamed to src/Java.Interop/Java.Interop/IJniObjectReferenceManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace Java.Interop {
1111

1212
// Implementations MUST be thread safe!
13-
public interface IJniHandleManager : IDisposable {
13+
public interface IJniObjectReferenceManager : IDisposable {
1414

1515
int GlobalReferenceCount {get;}
1616
int WeakGlobalReferenceCount {get;}

src/Java.Interop/Java.Interop/JavaVM.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class JavaVMOptions {
5151

5252
public IntPtr InvocationPointer {get; set;}
5353
public IntPtr EnvironmentPointer {get; set;}
54-
public IJniHandleManager JniHandleManager {get; set;}
54+
public IJniObjectReferenceManager JniHandleManager {get; set;}
5555

5656
public JavaVMOptions ()
5757
{
@@ -122,7 +122,7 @@ protected JavaVM (JavaVMOptions options)
122122
TrackIDs = options.TrackIDs;
123123
DestroyVM = options.DestroyVMOnDispose;
124124

125-
JniHandleManager = options.JniHandleManager ?? new JniHandleManager ();
125+
JniHandleManager = options.JniHandleManager ?? new JniObjectReferenceManager ();
126126
NewObjectRequired = options.NewObjectRequired;
127127

128128
InvocationPointer = options.InvocationPointer;
@@ -242,7 +242,7 @@ public int WeakGlobalReferenceCount {
242242
get {return JniHandleManager.WeakGlobalReferenceCount;}
243243
}
244244

245-
public IJniHandleManager JniHandleManager {get; private set;}
245+
public IJniObjectReferenceManager JniHandleManager {get; private set;}
246246

247247
public bool TrackIDs {get; private set;}
248248

src/Java.Interop/Java.Interop/JniHandleManager.cs renamed to src/Java.Interop/Java.Interop/JniObjectReferenceManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace Java.Interop {
1111

12-
public class JniHandleManager : IJniHandleManager {
12+
public class JniObjectReferenceManager : IJniObjectReferenceManager {
1313

1414
int grefc;
1515
public int GlobalReferenceCount {

src/Java.Interop/Tests/Interop-Tests.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\JniTypeInfoAttributeTest.cs" />
4343
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\JniTypeInfoTest.cs" />
4444
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\JniTypeTest.cs" />
45-
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\LoggingJniHandleManagerDecorator.cs" />
4645
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\MethodBindingTests.cs" />
4746
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\TestType.cs" />
4847
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\TestTypeTests.cs" />
48+
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\LoggingJniObjectReferenceManagerDecorator.cs" />
4949
</ItemGroup>
5050
<ItemGroup>
5151
<JavaInteropTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\CallNonvirtualBase.java" />

src/Java.Interop/Tests/Java.Interop/LoggingJniHandleManagerDecorator.cs renamed to src/Java.Interop/Tests/Java.Interop/LoggingJniObjectReferenceManagerDecorator.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
namespace Java.InteropTests {
1010

11-
class LoggingJniHandleManagerDecorator : IJniHandleManager {
11+
class LoggingJniObjectReferenceManagerDecorator : IJniObjectReferenceManager {
1212

1313
TextWriter grefLog;
1414
TextWriter lrefLog;
15-
IJniHandleManager manager;
1615

17-
public LoggingJniHandleManagerDecorator (IJniHandleManager manager, TextWriter lrefOutput = null, TextWriter grefOutput = null)
16+
IJniObjectReferenceManager manager;
17+
18+
public LoggingJniObjectReferenceManagerDecorator (IJniObjectReferenceManager manager, TextWriter lrefOutput = null, TextWriter grefOutput = null)
1819
{
1920
if (manager == null)
2021
throw new ArgumentNullException ("manager");
@@ -32,7 +33,7 @@ public int WeakGlobalReferenceCount {
3233
get {return manager.WeakGlobalReferenceCount;}
3334
}
3435

35-
public static IJniHandleManager GetHandleManager (IJniHandleManager manager)
36+
public static IJniObjectReferenceManager GetObjectReferenceManager (IJniObjectReferenceManager manager)
3637
{
3738
TextWriter grefLog = null;
3839
TextWriter lrefLog = null;;
@@ -59,7 +60,7 @@ public static IJniHandleManager GetHandleManager (IJniHandleManager manager)
5960

6061
if (grefLog == null && lrefLog == null)
6162
return manager;
62-
return new LoggingJniHandleManagerDecorator (manager, lrefLog, grefLog);
63+
return new LoggingJniObjectReferenceManagerDecorator (manager, lrefLog, grefLog);
6364
}
6465

6566
static string GetLogPath (string value)

tests/TestJVM/TestJVM.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static JreVMBuilder CreateBuilder (string[] jars)
1919
builder.ClassPath.Add (jar);
2020
}
2121
builder.AddOption ("-Xcheck:jni");
22-
builder.JniHandleManager = LoggingJniHandleManagerDecorator.GetHandleManager (new Java.Interop.JniHandleManager ());
22+
builder.JniHandleManager = LoggingJniObjectReferenceManagerDecorator.GetObjectReferenceManager (new Java.Interop.JniObjectReferenceManager ());
2323

2424
return builder;
2525
}

tests/TestJVM/TestJVM.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
4545
<ItemGroup>
4646
<Compile Include="TestJVM.cs" />
47-
<Compile Include="..\..\src\Java.Interop\Tests\Java.Interop\LoggingJniHandleManagerDecorator.cs">
48-
<Link>LoggingJniHandleManagerDecorator.cs</Link>
47+
<Compile Include="..\..\src\Java.Interop\Tests\Java.Interop\LoggingJniObjectReferenceManagerDecorator.cs">
48+
<Link>LoggingJniObjectReferenceManagerDecorator.cs</Link>
4949
</Compile>
5050
</ItemGroup>
5151
<ItemGroup>

0 commit comments

Comments
 (0)