Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion external/cecil
Submodule cecil updated from 172c90 to d0cb2b
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static class AssemblyResolverCoda {

public static AssemblyDefinition GetAssembly (this IAssemblyResolver resolver, string fileName)
{
return resolver.Resolve (Path.GetFileNameWithoutExtension (fileName));
return resolver.Resolve (AssemblyNameReference.Parse (Path.GetFileNameWithoutExtension (fileName)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public virtual IJavaPeerable CreatePeer (ref JniObjectReference reference, JniOb
targetType = GetPeerType (targetType);

if (!typeof (IJavaPeerable).GetTypeInfo ().IsAssignableFrom (targetType.GetTypeInfo ()))
throw new ArgumentException ("targetType must implement IJavaPeerable!", "targetType");
throw new ArgumentException ($"targetType `{targetType.AssemblyQualifiedName}` must implement IJavaPeerable!", "targetType");

var ctor = GetPeerConstructor (reference, targetType);
if (ctor == null)
Expand Down
2 changes: 2 additions & 0 deletions src/Java.Interop/Java.Interop/JniType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public sealed class JniType : IDisposable {

public static unsafe JniType DefineClass (string name, JniObjectReference loader, byte[] classFileData)
{
if (classFileData == null)
return null;
fixed (byte* buf = classFileData) {
var lref = JniEnvironment.Types.DefineClass (name, loader, (IntPtr) buf, classFileData.Length);
return new JniType (ref lref, JniObjectReferenceOptions.CopyAndDispose);
Expand Down
52 changes: 29 additions & 23 deletions src/Java.Interop/Tests/Java.Interop/TestType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,37 +103,43 @@ public bool PropogateFinallyBlockExecuted {

static Delegate GetEqualsThisHandler ()
{
Func<IntPtr, IntPtr, IntPtr, bool> h = (jnienv, n_self, n_value) => {
var jvm = JniEnvironment.Runtime;
var r_self = new JniObjectReference (n_self);
var self = jvm.ValueManager.GetValue<TestType>(ref r_self, JniObjectReferenceOptions.CopyAndDoNotRegister);
var r_value = new JniObjectReference (n_self);
var value = jvm.ValueManager.GetValue<IJavaPeerable> (ref r_value, JniObjectReferenceOptions.CopyAndDoNotRegister);

try {
return self.EqualsThis (value);
} finally {
self.DisposeUnlessReferenced ();
value.DisposeUnlessReferenced ();
}
};
Func<IntPtr, IntPtr, IntPtr, bool> h = _EqualsThis;
return JniEnvironment.Runtime.MarshalMemberBuilder.CreateMarshalToManagedDelegate (h);
}

static bool _EqualsThis (IntPtr jnienv, IntPtr n_self, IntPtr n_value)
{
var jvm = JniEnvironment.Runtime;
var r_self = new JniObjectReference (n_self);
var self = jvm.ValueManager.GetValue<TestType>(ref r_self, JniObjectReferenceOptions.CopyAndDoNotRegister);
var r_value = new JniObjectReference (n_self);
var value = jvm.ValueManager.GetValue<IJavaPeerable> (ref r_value, JniObjectReferenceOptions.CopyAndDoNotRegister);

try {
return self.EqualsThis (value);
} finally {
self.DisposeUnlessReferenced ();
value.DisposeUnlessReferenced ();
}
}

static Delegate GetInt32ValueHandler ()
{
Func<IntPtr, IntPtr, int> h = (jnienv, n_self) => {
var r_self = new JniObjectReference (n_self);
var self = JniEnvironment.Runtime.ValueManager.GetValue<TestType>(ref r_self, JniObjectReferenceOptions.CopyAndDoNotRegister);
try {
return self.GetInt32Value ();
} finally {
self.DisposeUnlessReferenced ();
}
};
Func<IntPtr, IntPtr, int> h = _GetInt32Value;
return JniEnvironment.Runtime.MarshalMemberBuilder.CreateMarshalToManagedDelegate (h);
}

static int _GetInt32Value (IntPtr jnienv, IntPtr n_self)
{
var r_self = new JniObjectReference (n_self);
var self = JniEnvironment.Runtime.ValueManager.GetValue<TestType>(ref r_self, JniObjectReferenceOptions.CopyAndDoNotRegister);
try {
return self.GetInt32Value ();
} finally {
self.DisposeUnlessReferenced ();
}
}

static Delegate _GetStringValueHandler ()
{
Func<IntPtr, IntPtr, int, IntPtr> h = GetStringValueHandler;
Expand Down
40 changes: 20 additions & 20 deletions src/Xamarin.Android.Cecil/assembly-rename.patch
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
diff --git a/Mono.Cecil.Cil/Symbols.cs b/Mono.Cecil.Cil/Symbols.cs
index 426c4a7..1bc138d 100644
index 6ca158e..dbca57a 100644
--- a/Mono.Cecil.Cil/Symbols.cs
+++ b/Mono.Cecil.Cil/Symbols.cs
@@ -186,7 +186,7 @@ namespace Mono.Cecil.Cil {
var cecil_name = typeof (SymbolProvider).Assembly.GetName ();
@@ -637,7 +637,7 @@ namespace Mono.Cecil.Cil {
var cecil_name = typeof (SymbolProvider).GetAssembly ().GetName ();

var name = new SR.AssemblyName {
- Name = "Mono.Cecil." + symbol_kind,
+ Name = "Xamarin.Android.Cecil." + symbol_kind,
- Name = "Mono.Cecil." + symbolKind,
+ Name = "Xamarin.Android.Cecil." + symbolKind,
Version = cecil_name.Version,
};

diff --git a/ProjectInfo.cs b/ProjectInfo.cs
index 8d427a7..59bc253 100644
--- a/ProjectInfo.cs
+++ b/ProjectInfo.cs
@@ -10,7 +10,7 @@
using System.Reflection;
using System.Runtime.InteropServices;

-[assembly: AssemblyProduct ("Mono.Cecil")]
+[assembly: AssemblyProduct ("Xamarin.Android.Cecil")]
[assembly: AssemblyCopyright ("Copyright © 2008 - 2015 Jb Evain")]

[assembly: ComVisible (false)]
diff --git a/Mono.Cecil/AssemblyInfo.cs b/Mono.Cecil/AssemblyInfo.cs
index 40cc0d4..41e159f 100644
index 4d32f2b..9726954 100644
--- a/Mono.Cecil/AssemblyInfo.cs
+++ b/Mono.Cecil/AssemblyInfo.cs
@@ -10,7 +10,7 @@ using System.Reflection;
@@ -12,7 +12,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

-[assembly: AssemblyTitle ("Mono.Cecil")]
+[assembly: AssemblyTitle ("Xamarin.Android.Cecil")]

#if !PCL && !NET_CORE
[assembly: Guid ("fd225bb4-fa53-44b2-a6db-85f5e48dcb54")]
diff --git a/ProjectInfo.cs b/ProjectInfo.cs
index 6bfdedf..95b940c 100644
--- a/ProjectInfo.cs
+++ b/ProjectInfo.cs
@@ -10,7 +10,7 @@
using System.Reflection;
using System.Runtime.InteropServices;

-[assembly: AssemblyProduct ("Mono.Cecil")]
+[assembly: AssemblyProduct ("Xamarin.Android.Cecil")]
[assembly: AssemblyCopyright ("Copyright © 2008 - 2015 Jb Evain")]

#if !PCL
7 changes: 7 additions & 0 deletions xa-gendarme-ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ R: Gendarme.Rules.Correctness.CheckParametersNullityInVisibleMethodsRule
M: System.Boolean Java.Interop.JniPeerMembers::UsesVirtualDispatch(Java.Interop.IJavaPeerable,System.Type)
M: Java.Interop.JniPeerMembers Java.Interop.JniPeerMembers::GetPeerMembers(Java.Interop.IJavaPeerable)

# I suspect a gendarme bug; I don't see what it's talking about
M: System.Void Java.Interop.JniArgumentValue::.ctor(Java.Interop.IJavaPeerable)


R: Gendarme.Rules.Correctness.EnsureLocalDisposalRule
# We don't *want* to dispose the value!
Expand Down Expand Up @@ -213,6 +216,10 @@ M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_boolean_array
M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_boolean_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Boolean*)
M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_primitive_array_critical(System.IntPtr,System.IntPtr,System.Boolean*)

R: Gendarme.Rules.Maintainability.AvoidAlwaysNullFieldRule
# I suspect that this is a Roslyn bug; mcs output doesn't produce this.
T: Java.Interop.JniRuntime/JniTypeManager/<CreateGetTypesForSimpleReferenceEnumerator>d__15


R: Gendarme.Rules.Maintainability.AvoidLackOfCohesionOfMethodsRule
# I'm not sure I understand "lack of cohesion" in this context, and the docs
Expand Down