/// <summary> /// Gets the parameter names of a method. /// </summary> /// <param name="jm">The java method.</param> /// <param name="jc">The java class.</param> /// <returns>The parameter names of the java method.</returns> public static string[] GetParameterNames(this JavaMethod jm, JavaClass jc) { Guard.NotNull(ref jc, nameof(jc)); Guard.NotNull(ref jm, nameof(jm)); JavaAttributeMethodParameters attribute = jm.GetAttribute <JavaAttributeMethodParameters>(); if (attribute == null) { int count = jm.GetParameterTypes(jc).Length; return(Enumerable.Range(0, count).Select(x => $"obj{x}").ToArray()); } return(attribute.Parameters.Select(x => jc.GetConstant <JavaConstantUtf8>(x.NameIndex).Value).ToArray()); }
/// <summary> /// Gets the code. /// </summary> /// <param name="jm">The java method.</param> /// <returns>The bytes representing the byte code.</returns> public static byte[] GetCode(this JavaMethod jm) { return(jm.GetAttribute <JavaAttributeCode>()?.Code); }