raulraja
02/07/2018, 9:48 PMProtobuf.Function
has an override
modifier but don't see anything in the flags for that. Any ideas or has anybody else attempted this before?. I'm in the context of processing annotations. Let me know if #kapt is better suited for this. thanks!Eugenio
02/07/2018, 9:59 PMkotlin-metadata
as the ProtoBuf.Function.memberKind: MemberKind?
extension, where MemberKind
is an enum of DECLARATION, FAKE_OVERRIDE, DELEGATION, SYNTHESIZED
Eugenio
02/07/2018, 10:00 PMraulraja
02/07/2018, 10:02 PMProtobuf.Function
to those?Eugenio
02/07/2018, 10:02 PMElement
, no?raulraja
02/07/2018, 10:03 PMtarget.classOrPackageProto.functionList
Eugenio
02/07/2018, 10:05 PMraulraja
02/07/2018, 10:05 PMTypeElement
Eugenio
02/07/2018, 10:05 PM/**
* If possible, returns the [ProtoBuf.Function] inside [functionList] represented by [methodElement].
*/
fun getFunctionOrNull(
methodElement: ExecutableElement,
nameResolver: NameResolver,
functionList: List<ProtoBuf.Function>,
typeUtils: Types
): ProtoBuf.Function? =
methodElement.getJvmMethodSignature(typeUtils).let { methodSignature ->
functionList.firstOrNull { methodSignature == it.getJvmMethodSignature(nameResolver) }
}
/** @see [getFunctionOrNull] */
fun ClassData.getFunctionOrNull(
methodElement: ExecutableElement,
typeUtils: Types
) =
getFunctionOrNull(methodElement, nameResolver, proto.functionList, typeUtils)
/** @see [getFunctionOrNull] */
fun PackageData.getFunctionOrNull(
methodElement: ExecutableElement,
typeUtils: Types
) =
getFunctionOrNull(methodElement, nameResolver, proto.functionList, typeUtils)
Eugenio
02/07/2018, 10:06 PMraulraja
02/07/2018, 10:06 PMEugenio
02/07/2018, 10:07 PMExecutableElement
, then it's about understanding the class hierarchy and see where that was declarated originallyEugenio
02/07/2018, 10:07 PMEugenio
02/07/2018, 10:08 PMraulraja
02/07/2018, 11:02 PMoverride
so I'm assuming the Kotlin compiler just inserts @Override
annotating the method as such. Can't figure out how to extract the function annotations to see if that is presentEugenio
02/08/2018, 8:42 AMEugenio
02/08/2018, 10:17 AMraulraja
02/08/2018, 11:05 AMEugenio
02/08/2018, 11:06 AM@Override
annotation is completely optional on the JVMEugenio
02/08/2018, 11:09 AMraulraja
02/08/2018, 11:09 AMraulraja
02/08/2018, 11:09 AMEugenio
02/08/2018, 11:11 AMEugenio
02/08/2018, 11:12 AMraulraja
02/08/2018, 11:19 AMEugenio
02/08/2018, 11:20 AMEugenio
02/08/2018, 11:20 AMEugenio
02/08/2018, 11:21 AMEugenio
02/08/2018, 11:21 AM