Skip to content

Commit 8bb341f

Browse files
committed
[Java.Interop.Dynamic] Turn into a PCL library, use on Android.
Java.Interop.Dynamic was originally written as a Desktop profile library for two reasons: 1. It "needed" Mono.Linq.Expressions to assist debugging, and Mono.Linq.Expressions wasn't a PCL; and 2. JniPeerMembers required that the Type passed follow certain requirements, specifically that the type have a [JniTypeInfo] custom attribute, which in turn requires a TypeBuilder, which isn't provided in any PCL profile. I *really* want Java.Inteorp.Dynamic as a PCL and on Android, so it's time to address these. To fix (1), just remove use of Mono.Linq.Expressions; it's only needed for debugging. (I should also look into turning Mono.Linq.Expressions into a PCL as well...) To fix (2)...punt: add a new private JniPeerMembers.CreatePeerMembers() method which skips the Type/[JniTypeInfo] check, use Reflection to invoke CreatePeerMembers(), and "fix" JniPeerInstanceMethods so that when DeclaringType is null -- which it will be if DynamicJavaClass created the instance -- we treat it the same as if self.GetType() matched DeclaringType: // old and busted if (self.GetType () == DeclaringType) ... // New hotness if (self.GetType () == DeclaringType || DeclaringType == null) ... (The JniPeerInstanceMethods change is required for Performance-Tests to pass, including Android.Interop-Tests.) Finally, turn the Java.Interop.Dynamic unit tests into a Shared Project so that they may be easily used between the (new) Java.Interop.Dynamic-Tests NUnit project and Android.Interop-Tests.
1 parent 9a64fef commit 8bb341f

File tree

14 files changed

+200
-68
lines changed

14 files changed

+200
-68
lines changed

Java.Interop.sln

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{4C173212-3
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop", "src\Java.Interop\Java.Interop.csproj", "{94BD81F7-B06F-4295-9636-F8A3B6BDC762}"
1111
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop.Dynamic", "src\Java.Interop.Dynamic\Java.Interop.Dynamic.csproj", "{AD4468F8-8883-434B-9D4C-E1801BB3B52A}"
13+
EndProject
1214
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop.Export", "src\Java.Interop.Export\Java.Interop.Export.csproj", "{B501D075-6183-4E1D-92C9-F7B5002475B1}"
1315
EndProject
1416
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core-Tests", "Core-Tests", "{647B3EED-85D7-45E6-A297-44DC70C79503}"
1517
EndProject
1618
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Interop-Tests", "src\Java.Interop\Tests\Interop-Tests.shproj", "{0ADB8D72-7479-49AF-8809-E03AE4A4EAE2}"
1719
EndProject
20+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Dynamic-Tests", "src\Java.Interop.Dynamic\Tests\Dynamic-Tests.shproj", "{8A190F28-74C7-45D8-A701-5864CDF4124A}"
21+
EndProject
1822
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Export-Tests", "src\Java.Interop.Export\Tests\Export-Tests.shproj", "{849ABEDC-6A9C-44F0-8543-5298C096A3FB}"
1923
EndProject
2024
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Performance-Tests", "tests\PerformanceTests\PerformanceTests.shproj", "{0FBECD2A-7C91-41AB-A4B4-B781E8EC8479}"
@@ -29,8 +33,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Linq.Expressions-Andro
2933
EndProject
3034
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Desktop", "Desktop", "{0998E45F-8BCE-4791-A944-962CD54E2D80}"
3135
EndProject
32-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop.Dynamic", "src\Java.Interop.Dynamic\Java.Interop.Dynamic.csproj", "{AD4468F8-8883-434B-9D4C-E1801BB3B52A}"
33-
EndProject
3436
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Runtime.Environment", "src\Java.Runtime.Environment\Java.Runtime.Environment.csproj", "{5887B410-D448-4257-A46B-EAC03C80BE93}"
3537
EndProject
3638
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Desktop-Tests", "Desktop-Tests", "{271C9F30-F679-4793-942B-0D9527CB3E2F}"
@@ -39,7 +41,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestJVM", "tests\TestJVM\Te
3941
EndProject
4042
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop-Tests", "tests\Java.Interop-Tests\Java.Interop-Tests.csproj", "{04E28441-36FF-4964-ADD7-EFBB47CCE406}"
4143
EndProject
42-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop.Dynamic-Tests", "src\Java.Interop.Dynamic\Tests\Java.Interop.Dynamic-Tests.csproj", "{447A2149-60AA-494C-A5CB-8B186F522F5D}"
44+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop.Dynamic-Tests", "tests\Java.Interop.Dynamic-Tests\Java.Interop.Dynamic-Tests.csproj", "{82B1DD53-69CA-4A61-B6B1-F06F1525EF4D}"
4345
EndProject
4446
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Java.Interop.Export-Tests", "tests\Java.Interop.Export-Tests\Java.Interop.Export-Tests.csproj", "{82F24161-F0CA-44CC-AEC3-885D613605E0}"
4547
EndProject
@@ -63,6 +65,10 @@ Global
6365
{04E28441-36FF-4964-ADD7-EFBB47CCE406}.Debug|Any CPU.Build.0 = Debug|Any CPU
6466
{04E28441-36FF-4964-ADD7-EFBB47CCE406}.Release|Any CPU.ActiveCfg = Release|Any CPU
6567
{04E28441-36FF-4964-ADD7-EFBB47CCE406}.Release|Any CPU.Build.0 = Release|Any CPU
68+
{82B1DD53-69CA-4A61-B6B1-F06F1525EF4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69+
{82B1DD53-69CA-4A61-B6B1-F06F1525EF4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
70+
{82B1DD53-69CA-4A61-B6B1-F06F1525EF4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
71+
{82B1DD53-69CA-4A61-B6B1-F06F1525EF4D}.Release|Any CPU.Build.0 = Release|Any CPU
6672
{0C001D50-4176-45AE-BDC8-BA626508B0CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
6773
{0C001D50-4176-45AE-BDC8-BA626508B0CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
6874
{0C001D50-4176-45AE-BDC8-BA626508B0CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -119,10 +125,6 @@ Global
119125
{F3ECB73D-9263-4E42-A5B4-3FC0D1D829F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
120126
{F3ECB73D-9263-4E42-A5B4-3FC0D1D829F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
121127
{F3ECB73D-9263-4E42-A5B4-3FC0D1D829F9}.Release|Any CPU.Build.0 = Release|Any CPU
122-
{447A2149-60AA-494C-A5CB-8B186F522F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
123-
{447A2149-60AA-494C-A5CB-8B186F522F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
124-
{447A2149-60AA-494C-A5CB-8B186F522F5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
125-
{447A2149-60AA-494C-A5CB-8B186F522F5D}.Release|Any CPU.Build.0 = Release|Any CPU
126128
EndGlobalSection
127129
GlobalSection(NestedProjects) = preSolution
128130
{F3ECB73D-9263-4E42-A5B4-3FC0D1D829F9} = {D5A93398-AEB1-49F3-89DC-3904A47DB0C7}
@@ -131,15 +133,16 @@ Global
131133
{9ECA2816-41D2-4796-8CA2-758EDCFB5C68} = {7B305D7C-ADCF-444E-BBFD-4C5CB306B3C6}
132134
{94BD81F7-B06F-4295-9636-F8A3B6BDC762} = {4C173212-371D-45D8-BA83-9226194F48DC}
133135
{AD4468F8-8883-434B-9D4C-E1801BB3B52A} = {4C173212-371D-45D8-BA83-9226194F48DC}
134-
{447A2149-60AA-494C-A5CB-8B186F522F5D} = {271C9F30-F679-4793-942B-0D9527CB3E2F}
135136
{B501D075-6183-4E1D-92C9-F7B5002475B1} = {4C173212-371D-45D8-BA83-9226194F48DC}
136137
{0ADB8D72-7479-49AF-8809-E03AE4A4EAE2} = {647B3EED-85D7-45E6-A297-44DC70C79503}
138+
{8A190F28-74C7-45D8-A701-5864CDF4124A} = {647B3EED-85D7-45E6-A297-44DC70C79503}
137139
{849ABEDC-6A9C-44F0-8543-5298C096A3FB} = {647B3EED-85D7-45E6-A297-44DC70C79503}
138140
{0FBECD2A-7C91-41AB-A4B4-B781E8EC8479} = {647B3EED-85D7-45E6-A297-44DC70C79503}
139141
{5887B410-D448-4257-A46B-EAC03C80BE93} = {0998E45F-8BCE-4791-A944-962CD54E2D80}
140142
{A76309AB-98AC-4AE2-BA30-75481420C52F} = {271C9F30-F679-4793-942B-0D9527CB3E2F}
141143
{6970466B-F6D1-417A-8A27-4FED8555EBD0} = {271C9F30-F679-4793-942B-0D9527CB3E2F}
142144
{04E28441-36FF-4964-ADD7-EFBB47CCE406} = {271C9F30-F679-4793-942B-0D9527CB3E2F}
145+
{82B1DD53-69CA-4A61-B6B1-F06F1525EF4D} = {271C9F30-F679-4793-942B-0D9527CB3E2F}
143146
{82F24161-F0CA-44CC-AEC3-885D613605E0} = {271C9F30-F679-4793-942B-0D9527CB3E2F}
144147
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A} = {C8F58966-94BF-407F-914A-8654F8B8AE3B}
145148
{0C001D50-4176-45AE-BDC8-BA626508B0CC} = {C8F58966-94BF-407F-914A-8654F8B8AE3B}

src/Android.Interop/Tests/Android.Interop-Tests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<Reference Include="System" />
4646
<Reference Include="System.Xml" />
4747
<Reference Include="System.Core" />
48+
<Reference Include="Microsoft.CSharp" />
4849
<Reference Include="Mono.Android" />
4950
<Reference Include="Xamarin.Android.NUnitLite" />
5051
</ItemGroup>
@@ -73,6 +74,7 @@
7374
<Import Project="..\..\Java.Interop\Tests\Interop-Tests.projitems" Label="Shared" Condition="Exists('..\..\Java.Interop\Tests\Interop-Tests.projitems')" />
7475
<Import Project="..\..\Java.Interop.Export\Tests\Export-Tests.projitems" Label="Shared" Condition="Exists('..\..\Java.Interop.Export\Tests\Export-Tests.projitems')" />
7576
<Import Project="..\..\..\tests\PerformanceTests\PerformanceTests.projitems" Label="Shared" Condition="Exists('..\..\..\tests\PerformanceTests\PerformanceTests.projitems')" />
77+
<Import Project="..\..\Java.Interop.Dynamic\Tests\Dynamic-Tests.projitems" Label="Shared" Condition="Exists('..\..\Java.Interop.Dynamic\Tests\Dynamic-Tests.projitems')" />
7678
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
7779
<PropertyGroup>
7880
<BuildDependsOn>
@@ -100,6 +102,10 @@
100102
<Project>{9ECA2816-41D2-4796-8CA2-758EDCFB5C68}</Project>
101103
<Name>Mono.Linq.Expressions-Android</Name>
102104
</ProjectReference>
105+
<ProjectReference Include="..\..\Java.Interop.Dynamic\Java.Interop.Dynamic.csproj">
106+
<Project>{AD4468F8-8883-434B-9D4C-E1801BB3B52A}</Project>
107+
<Name>Java.Interop.Dynamic</Name>
108+
</ProjectReference>
103109
</ItemGroup>
104110
<ItemGroup>
105111
<AndroidJavaLibrary Include="..\..\..\bin\$(Configuration)\export-test.jar">

src/Java.Interop.Dynamic/Java.Interop.Dynamic.csproj

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
<ProductVersion>8.0.30703</ProductVersion>
77
<SchemaVersion>2.0</SchemaVersion>
88
<ProjectGuid>{AD4468F8-8883-434B-9D4C-E1801BB3B52A}</ProjectGuid>
9+
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
910
<OutputType>Library</OutputType>
1011
<RootNamespace>Java.Interop.Dynamic</RootNamespace>
1112
<AssemblyName>Java.Interop.Dynamic</AssemblyName>
12-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<TargetFrameworkProfile>Profile6</TargetFrameworkProfile>
14+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1315
</PropertyGroup>
1416
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1517
<DebugSymbols>true</DebugSymbols>
@@ -29,19 +31,12 @@
2931
<WarningLevel>4</WarningLevel>
3032
<ConsolePause>false</ConsolePause>
3133
</PropertyGroup>
32-
<ItemGroup>
33-
<Reference Include="System" />
34-
</ItemGroup>
3534
<ItemGroup>
3635
<Compile Include="Properties\AssemblyInfo.cs" />
3736
<Compile Include="Java.Interop.Dynamic\DynamicJavaClass.cs" />
3837
</ItemGroup>
39-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
38+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
4039
<ItemGroup>
41-
<ProjectReference Include="..\..\lib\mono.linq.expressions\Mono.Linq.Expressions.csproj">
42-
<Project>{0C001D50-4176-45AE-BDC8-BA626508B0CC}</Project>
43-
<Name>Mono.Linq.Expressions</Name>
44-
</ProjectReference>
4540
<ProjectReference Include="..\Java.Interop\Java.Interop.csproj">
4641
<Project>{94BD81F7-B06F-4295-9636-F8A3B6BDC762}</Project>
4742
<Name>Java.Interop</Name>

src/Java.Interop.Dynamic/Java.Interop.Dynamic/DynamicJavaClass.cs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,26 @@
55
using System.Linq;
66
using System.Linq.Expressions;
77
using System.Reflection;
8-
using System.Reflection.Emit;
98
using System.Text;
109

11-
using Mono.Linq.Expressions;
12-
1310
using Java.Interop;
1411

1512
namespace Java.Interop.Dynamic {
1613

1714
public class DynamicJavaClass : IDynamicMetaObjectProvider
1815
{
16+
readonly static Func<string, JniPeerMembers> CreatePeerMembers;
17+
18+
static DynamicJavaClass ()
19+
{
20+
CreatePeerMembers = (Func<string, JniPeerMembers>)
21+
Delegate.CreateDelegate (
22+
typeof(Func<string, JniPeerMembers>),
23+
typeof(JniPeerMembers).GetMethod ("CreatePeerMembers", BindingFlags.NonPublic | BindingFlags.Static));
24+
if (CreatePeerMembers == null)
25+
throw new NotSupportedException ("Could not find JniPeerMembers.CreatePeerMembers!");
26+
}
27+
1928
public string JniClassName {get; private set;}
2029

2130
JniPeerMembers members;
@@ -26,7 +35,7 @@ public DynamicJavaClass (string jniClassName)
2635
throw new ArgumentNullException ("jniClassName");
2736

2837
JniClassName = jniClassName;
29-
members = new JniPeerMembers (jniClassName, CreateManagedPeerType ());
38+
members = CreatePeerMembers (jniClassName);
3039
}
3140

3241
DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject (Expression parameter)
@@ -41,7 +50,7 @@ internal StaticMethodAccess GetStaticMethodAccess (InvokeMemberBinder binder, Dy
4150

4251
public object CallStaticMethod (InvokeMemberBinder binder, DynamicMetaObject[] args, Type returnType)
4352
{
44-
Console.WriteLine ("# DynamicJavaClass({0}).invoke({1}) with args({2}) as {3}",
53+
Debug.WriteLine ("# DynamicJavaClass({0}).invoke({1}) with args({2}) as {3}",
4554
JniClassName, binder.Name, string.Join (", ", args.Select (a => a.Value)), returnType);
4655
var encoded = GetEncodedJniSignature (binder, args, returnType);
4756
var margs = args.Select (arg => new JniArgumentMarshalInfo (arg.Value, arg.LimitType)).ToList ();
@@ -73,15 +82,15 @@ static string GetEncodedJniSignature (InvokeMemberBinder binder, DynamicMetaObje
7382

7483
public object GetStaticFieldValue (string fieldName, Type fieldType)
7584
{
76-
Console.WriteLine ("# DynamicJavaClass({0}).field({1}) as {2}", JniClassName, fieldName, fieldType);
85+
Debug.WriteLine ("# DynamicJavaClass({0}).field({1}) as {2}", JniClassName, fieldName, fieldType);
7786
var typeInfo = JniEnvironment.Current.JavaVM.GetJniTypeInfoForType (fieldType);
7887
var encoded = fieldName + "\u0000" + typeInfo.ToString ();
7988
return members.StaticFields.GetValue (encoded);
8089
}
8190

8291
public void SetStaticFieldValue (string fieldName, Type fieldType, object value)
8392
{
84-
Console.WriteLine ("# DynamicJavaClass({0}).field({1}) as {2} = {3}", JniClassName, fieldName, fieldType, value);
93+
Debug.WriteLine ("# DynamicJavaClass({0}).field({1}) as {2} = {3}", JniClassName, fieldName, fieldType, value);
8594
var typeInfo = JniEnvironment.Current.JavaVM.GetJniTypeInfoForType (fieldType);
8695
var encoded = fieldName + "\u0000" + typeInfo.ToString ();
8796
members.StaticFields.SetValue (encoded, value);
@@ -92,6 +101,7 @@ internal StaticFieldAccess GetStaticFieldAccess (string fieldName)
92101
return new StaticFieldAccess (this, fieldName);
93102
}
94103

104+
#if false
95105
Type CreateManagedPeerType ()
96106
{
97107
var className = JniClassName.Replace ('/', '-');
@@ -107,6 +117,7 @@ Type CreateManagedPeerType ()
107117

108118
return type.CreateType ();
109119
}
120+
#endif
110121
}
111122

112123
class DynamicMetaObject<T> : DynamicMetaObject {
@@ -130,20 +141,20 @@ class MetaStaticMemberAccessObject : DynamicMetaObject<DynamicJavaClass>
130141
public MetaStaticMemberAccessObject (Expression parameter, DynamicJavaClass value)
131142
: base (parameter, value)
132143
{
133-
Console.WriteLine ("# MyMetaObject..ctor: paramter={0} {1} {2}", parameter.ToCSharpCode (), parameter.GetType (), parameter.Type);
134-
Console.WriteLine ("# MyMetaObject..ctor: value={0} {1}", value, value.GetType ());
144+
// Console.WriteLine ("# MyMetaObject..ctor: paramter={0} {1} {2}", parameter.ToCSharpCode (), parameter.GetType (), parameter.Type);
145+
Debug.WriteLine ("# MyMetaObject..ctor: value={0} {1}", value, value.GetType ());
135146
}
136147

137148
public override DynamicMetaObject BindConvert(ConvertBinder binder)
138149
{
139-
Console.WriteLine ("Convert: Expression={0} [{1}]", Expression.ToCSharpCode (), Expression.Type);
150+
// Console.WriteLine ("Convert: Expression={0} [{1}]", Expression.ToCSharpCode (), Expression.Type);
140151
throw new NotSupportedException ("How is this being invoked?!");
141152
}
142153

143154
public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
144155
{
145-
Console.WriteLine ("InvokeMember of method={0}; ReturnType={1}; args={{{2}}}; CallInfo={3}", binder.Name, binder.ReturnType,
146-
string.Join (", ", args.Select (a => string.Format ("{0} [{1}]", a.Expression.ToCSharpCode (), a.LimitType))), binder.CallInfo);
156+
// Console.WriteLine ("InvokeMember of method={0}; ReturnType={1}; args={{{2}}}; CallInfo={3}", binder.Name, binder.ReturnType,
157+
// string.Join (", ", args.Select (a => string.Format ("{0} [{1}]", a.Expression.ToCSharpCode (), a.LimitType))), binder.CallInfo);
147158

148159
Func<InvokeMemberBinder, DynamicMetaObject[], StaticMethodAccess> gsma = Value.GetStaticMethodAccess;
149160

@@ -162,7 +173,7 @@ public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, Dy
162173

163174
public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value)
164175
{
165-
Console.WriteLine ("SetMember: Expression={0} [{1}]; property={2}; value.LimitType={3}; value.RuntimeType={4}; value.Value={5}", Expression.ToCSharpCode (), Expression.Type, binder.Name, value.LimitType, value.RuntimeType, value.Value);
176+
// Console.WriteLine ("SetMember: Expression={0} [{1}]; property={2}; value.LimitType={3}; value.RuntimeType={4}; value.Value={5}", Expression.ToCSharpCode (), Expression.Type, binder.Name, value.LimitType, value.RuntimeType, value.Value);
166177
var self = Value;
167178
var fieldValue = value.Expression;
168179
if (!value.HasValue) {
@@ -184,7 +195,7 @@ public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicM
184195

185196
public override DynamicMetaObject BindGetMember(GetMemberBinder binder)
186197
{
187-
Console.WriteLine ("GetMember: Expression={0} [{1}]; property={2}", Expression.ToCSharpCode (), Expression.Type, binder.Name);
198+
// Console.WriteLine ("GetMember: Expression={0} [{1}]; property={2}", Expression.ToCSharpCode (), Expression.Type, binder.Name);
188199
var expr =
189200
Expression.Call (
190201
ExpressionAsT,
@@ -213,7 +224,7 @@ public StaticMethodAccess (DynamicJavaClass klass, InvokeMemberBinder invokeBind
213224

214225
public DynamicMetaObject GetMetaObject(Expression parameter)
215226
{
216-
Console.WriteLine ("# StaticMethodAccess.GetMetaObject: parameter={0}", parameter);
227+
// Console.WriteLine ("# StaticMethodAccess.GetMetaObject: parameter={0}", parameter);
217228
return new MetaStaticMethodAccessObject (parameter, this);
218229
}
219230
}
@@ -223,12 +234,12 @@ class MetaStaticMethodAccessObject : DynamicMetaObject<StaticMethodAccess> {
223234
public MetaStaticMethodAccessObject (Expression e, StaticMethodAccess value)
224235
: base (e, value)
225236
{
226-
Console.WriteLine ("MetaStaticMethodAccessObject: e={0}", e.ToCSharpCode ());
237+
// Console.WriteLine ("MetaStaticMethodAccessObject: e={0}", e.ToCSharpCode ());
227238
}
228239

229240
public override DynamicMetaObject BindConvert (ConvertBinder binder)
230241
{
231-
Console.WriteLine ("MetaStaticMethodAccessObject.Convert: Expression={0} [{1}]", Expression.ToCSharpCode (), Expression.Type);
242+
// Console.WriteLine ("MetaStaticMethodAccessObject.Convert: Expression={0} [{1}]", Expression.ToCSharpCode (), Expression.Type);
232243

233244
var method = ExpressionAsT;
234245
var instance = Expression.Property (method, "JavaClass");
@@ -259,7 +270,7 @@ public StaticFieldAccess (DynamicJavaClass klass, string fieldName)
259270

260271
public DynamicMetaObject GetMetaObject(Expression parameter)
261272
{
262-
Console.WriteLine ("# FieldAccessInfo.GetMetaObject: parameter={0}", parameter);
273+
// Console.WriteLine ("# FieldAccessInfo.GetMetaObject: parameter={0}", parameter);
263274
return new MetaStaticFieldAccessObject(parameter, this);
264275
}
265276
}
@@ -269,12 +280,12 @@ class MetaStaticFieldAccessObject : DynamicMetaObject<StaticFieldAccess> {
269280
public MetaStaticFieldAccessObject (Expression e, StaticFieldAccess value)
270281
: base (e, value)
271282
{
272-
Console.WriteLine ("MyHelperObject: e={0}", e.ToCSharpCode ());
283+
// Console.WriteLine ("MyHelperObject: e={0}", e.ToCSharpCode ());
273284
}
274285

275286
public override DynamicMetaObject BindConvert (ConvertBinder binder)
276287
{
277-
Console.WriteLine ("MetaStaticFieldAccessObject.Convert: Expression={0} [{1}]", Expression.ToCSharpCode (), Expression.Type);
288+
// Console.WriteLine ("MetaStaticFieldAccessObject.Convert: Expression={0} [{1}]", Expression.ToCSharpCode (), Expression.Type);
278289

279290
var field = ExpressionAsT;
280291
var instance = Expression.Property (field, "JavaClass");
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
<HasSharedItems>true</HasSharedItems>
6+
<SharedGUID>{8A190F28-74C7-45D8-A701-5864CDF4124A}</SharedGUID>
7+
</PropertyGroup>
8+
<PropertyGroup Label="Configuration">
9+
<Import_RootNamespace>Tests</Import_RootNamespace>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop.Dynamic\DynamicJavaClassTests.cs" />
13+
</ItemGroup>
14+
</Project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ProjectGuid>{8A190F28-74C7-45D8-A701-5864CDF4124A}</ProjectGuid>
5+
</PropertyGroup>
6+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
7+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
8+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
9+
<Import Project="Dynamic-Tests.projitems" Label="Shared" />
10+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
11+
</Project>

src/Java.Interop.Dynamic/Tests/Java.Interop.Dynamic/DynamicJavaClassTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Java.Interop.DynamicTests {
1515

1616
[TestFixture]
17-
class DynamicJavaClassTests : JVM
17+
class DynamicJavaClassTests : Java.InteropTests.JavaVMFixture
1818
{
1919
[Test]
2020
public void Constructor ()

0 commit comments

Comments
 (0)