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 src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected virtual IEnumerable<string> GetSimpleReferences (Type type)
static readonly Type[] EmptyTypeArray = Array.Empty<Type> ();


public Type GetType (JniTypeSignature typeSignature)
public Type? GetType (JniTypeSignature typeSignature)
{
AssertValid ();

Expand Down
4 changes: 3 additions & 1 deletion src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static Type GetPeerType (Type type)
return GetActivationConstructor (fallbackType);
}

static ConstructorInfo GetActivationConstructor (Type type)
static ConstructorInfo? GetActivationConstructor (Type type)
{
return
(from c in type.GetConstructors (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
Expand Down Expand Up @@ -675,6 +675,8 @@ public override Expression CreateReturnValueFromManagedExpression (JniValueMarsh

public override Expression CreateParameterToManagedExpression (JniValueMarshalerContext context, ParameterExpression sourceValue, ParameterAttributes synchronize, Type? targetType)
{
targetType ??= typeof (object);

var r = Expression.Variable (targetType, sourceValue.Name + "_val");
context.LocalVariables.Add (r);
context.CreationStatements.Add (
Expand Down
2 changes: 2 additions & 0 deletions src/Java.Interop/Java.Interop/JniStringValueMarshaler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public override Expression CreateParameterToManagedExpression (JniValueMarshaler
{
Func<IntPtr, string?> m = JniEnvironment.Strings.ToString;

targetType ??= typeof (object);

var value = Expression.Variable (targetType, sourceValue.Name + "_val");
context.LocalVariables.Add (value);
context.CreationStatements.Add (Expression.Assign (value, Expression.Call (m.GetMethodInfo (), sourceValue)));
Expand Down
4 changes: 2 additions & 2 deletions src/Java.Interop/Java.Interop/JniValueMarshaler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sealed class VariableCollection : KeyedCollection<string, ParameterExpression> {

protected override string GetKeyForItem (ParameterExpression item)
{
return item.Name;
return item.Name!;
}
}

Expand Down Expand Up @@ -169,7 +169,7 @@ public virtual Expression CreateReturnValueFromManagedExpressi
return ReturnObjectReferenceToJni (context, sourceValue.Name, Expression.Property (s, "ReferenceValue"));
}

protected Expression ReturnObjectReferenceToJni (JniValueMarshalerContext context, string namePrefix, Expression sourceValue)
protected Expression ReturnObjectReferenceToJni (JniValueMarshalerContext context, string? namePrefix, Expression sourceValue)
{
Func<JniObjectReference, IntPtr> m = JniEnvironment.References.NewReturnToJniRef;
var r = Expression.Variable (MarshalType, namePrefix + "_rtn");
Expand Down