micronaut-projects / micronaut-projects/micronaut-core

ksp throwing build error when using @Retryable

Open
#9,727 9 comments 0 reactions 0 assignees View on GitHub
lang: kotlin status: example attached status: validated type: bug
Dominant language
Java
Stars
6.4k
Forks
1.2k
Avg merge
1d 6h
Merged PRs (30d)
222

Description

### Expected Behavior

Using Retryable annotation on a fun within singleton class , it produces compilation errors
when executing gradle build , it should complete normally w/o any error

```
./gradlew.bat build
```

### Actual Behaviour

it produces error related to ksp and AOP
```
./gradlew.bat build

Welcome to Gradle 8.2.1!

Here are the highlights of this release:
- Kotlin DSL: new reference documentation, assignment syntax by default
- Kotlin DSL is now the default with Gradle init
- Improved suggestions to resolve errors in console output
- Reduced sync memory consumption

For more details see https://docs.gradle.org/8.2.1/release-notes.html

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Task :kspKotlin FAILED
e: [ksp] Originating element: getContent
e: [ksp] C:/GitHub/demo/src/main/kotlin/io/test/service/MicronautService.kt:9: Method defines AOP advice but is declared final. Change the method to be non-final in order for AOP advice to be applied.
e: Error occurred in KSP, check log for detail
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.2.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 11s
4 actionable tasks: 1 executed, 3 up-to-date
```

### Steps To Reproduce

Try executing gradle build by using one of the below
```
./gradlew build

```
or
```
./gradlew.bat build
```

### Environment Information

Windows/Linux/MacOS
JDK18 (same issue with JDK17)
Micronaut4 with ksp plugin
Kotlin 1.8

### Example Application

https://github.com/vensad/demo

### Version

4.0.3

Contributor guide

Open the contributing guide

Research direction

Start with the example application at https://github.com/vensad/demo, especially MicronautService.kt:9 and its @Retryable method inside the singleton. Run ./gradlew build or ./gradlew.bat build with the stated Micronaut 4.0.3, Kotlin 1.8, and KSP setup, then trace the KSP AOP error; done means the build completes without the final-method compilation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.