Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging with implicit property getter doesn't include the file or line number #2288

Open
ansman opened this issue Jan 6, 2025 · 0 comments

Comments

@ansman
Copy link
Contributor

ansman commented Jan 6, 2025

We have some code that processes properties and potentially logs an error. The property is defined like this:

abstract class SomeClass {
    @get:SomeAnnotation
    abstract val stuff: List<String>
}

We log an error like this:

fun KSPropertyGetter.logError() {
  environment.logger.error("Example error, this)
}

In KSP1 this would correctly print:

Test.kt:3: Example error

but in KSP2 this prints

Example error

If I use this.parent (which uses the property declaration) it works as expected. I assume this is because there no explicit getter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant