Skip to content

Instantly share code, notes, and snippets.

@romtsn
Created December 6, 2021 07:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save romtsn/2851b4d10ac6c84f81697708c10ab281 to your computer and use it in GitHub Desktop.
Bytecode Transformations: ClassVisitorFactory
abstract class SpanAddingClassVisitorFactory :
AsmClassVisitorFactory<SpanAddingClassVisitorFactory.SpanAddingParameters> {
interface SpanAddingParameters : InstrumentationParameters {
@get:Input
@get:Optional
val invalidate: Property<Long>
@get:Input
val debug: Property<Boolean>
@get:Internal
val tmpDir: Property<File>
}
override fun createClassVisitor(
classContext: ClassContext,
nextClassVisitor: ClassVisitor
): ClassVisitor =
TODO("If we return true from the isInstrumentable below, we should return a ClassVisitor that will inject our code for measuring the execution time")
override fun isInstrumentable(classData: ClassData): Boolean =
TODO("Determine if we are interested in instrumenting the given ClassData. For us it would mean a class annotated with @Dao")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment