Skip to content

Changelog

All notable changes to this project will be documented here.

The format follows Keep a Changelog, and this project adheres to Semantic Versioning.

[0.2.2]

Fixed

  • @Around on functions with complex bodies now compiles correctly — the IR deep-copy of the local function body was performed statement-by-statement, giving each call its own SymbolRemapper. References between local variables (e.g. val b = a + 1) were left pointing to the outer function's symbols, which the JVM lowering phase misidentified as closure captures. Once the outer body was cleared the missing frame slot caused IllegalStateException: No mapping for symbol at codegen. The entire body is now deep-copied in a single pass so all intra-body references are correctly remapped. (#AroundLocalFunctionGenerationTest)

  • @Around on functions containing lambdas or nested local functions no longer returns wrong valuesBodyTransformer.visitReturn previously redirected every IrReturn to the generated $<name> local function, including returns inside nested lambdas and local functions. This caused constructs such as listOf(1,2,3).sumOf { it + base } to short-circuit after the first element. The transformer now only redirects returns that originally targeted the outer function.

Added

  • Extension functions on JoinPoint (JoinPointExtensions.kt):

    • getArg<T>(name) — retrieves a named argument, cast to T; throws on missing name
    • getArgOrNull<T>(name) — same as above but returns null on missing name or cast failure
    • getTarget<T>() — casts target to T; throws on null or cast failure
    • getTargetOrNull<T>() — casts target to T; returns null otherwise
    • findAnnotation<T>() — finds AnnotationInfo by annotation type on the intercepted function
  • Extension functions on MethodSignature (MethodSignatureExtensions.kt):

    • findAnnotation<T>() — finds AnnotationInfo by annotation type in annotations
  • Extension functions on AnnotationInfo (AnnotationInfoExtensions.kt):

    • getArg<T>(paramName) — retrieves a named annotation argument, cast to T
    • getArgOrNull<T>(paramName) — same but returns null on missing name or cast failure

[0.2.0]

Added

  • @After advice annotation: runs after the target function body in a finally block, regardless of whether an exception was thrown
  • @Around advice annotation: replaces the target function call; the original body is invoked via ProceedingJoinPoint.proceed()
  • ProceedingJoinPoint interface with proceed() and proceed(vararg args) for argument substitution
  • DefaultProceedingJoinPoint runtime implementation generated at each @Around call site

Changed

  • Advice generation pipeline restructured: each AspectContext is now dispatched directly to its generator, eliminating redundant internal lookups

[0.1.1]

Added

  • Kotlin version validation: AspectK now throws a GradleException at configuration time if the project's Kotlin compiler version is not in the supported range

Changed

  • Kotlin version updated to 2.3.10
  • pluginId in AspectKCompilerPluginRegistrar now references BuildConfig.COMPILER_PLUGIN_ID instead of a hardcoded string

[0.1.0] — Initial Release

Added

  • @Aspect annotation to mark aspect classes
  • @Before advice annotation with target and inherits parameters
  • JoinPoint interface with target, signature, and args
  • MethodSignature with full compile-time metadata
  • MethodParameter with type, name, annotations, and nullability info
  • AnnotationInfo for runtime-accessible annotation metadata
  • Kotlin Multiplatform support (JVM, JS, WASM, Native Tier 1–3)
  • K2 IR-based compiler plugin (AspectKCompilerPluginRegistrar)
  • Gradle plugin (io.github.mole-labs.aspectk.compiler)
  • Many-to-many aspect-to-target relationships
  • Inheritance support via inherits = true
  • Thread-safe AspectLookUp implementation