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
4 changes: 2 additions & 2 deletions src/Xamarin.Android.Tools.Bytecode/ClassFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public bool TryGetEnclosingMethodInfo (out string declaringClass, out string dec
}

declaringClass = enclosingMethod.Class.Name.Value;
declaringMethod = enclosingMethod.Method.Name.Value;
declaringDescriptor = enclosingMethod.Method.Descriptor.Value;
declaringMethod = enclosingMethod.Method?.Name.Value;
declaringDescriptor = enclosingMethod.Method?.Descriptor.Value;
return true;
}

Expand Down
15 changes: 8 additions & 7 deletions src/Xamarin.Android.Tools.Bytecode/XmlClassDeclarationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ static string GetDeprecatedValue (AttributeCollection attributes)
return "deprecated";
}

XAttribute[] GetEnclosingMethod ()
IEnumerable<XAttribute> GetEnclosingMethod ()
{
string declaringClass, declaringMethod, declaringDescriptor;
if (!classFile.TryGetEnclosingMethodInfo (out declaringClass, out declaringMethod, out declaringDescriptor)) {
return null;
yield break;
}
return new []{
new XAttribute ("enclosing-method-jni-type", "L" + declaringClass + ";"),
new XAttribute ("enclosing-method-name", declaringMethod),
new XAttribute ("enclosing-method-signature", declaringDescriptor),
};
if (declaringClass != null)
yield return new XAttribute ("enclosing-method-jni-type", "L" + declaringClass + ";");
if (declaringMethod != null)
yield return new XAttribute ("enclosing-method-name", declaringMethod);
if (declaringDescriptor != null)
yield return new XAttribute ("enclosing-method-signature", declaringDescriptor);
}

XAttribute[] GetExtends ()
Expand Down