Fwd: ErrorProne in a mixed Java/Kotlin project

344 views
Skip to first unread message

Dmitrii Sergeev

unread,
May 4, 2020, 11:32:31 AM5/4/20
to error-pro...@googlegroups.com
Hi

First, I wanted to say thank you for developing ErrorProne, it's a very nifty tool.

I have a question about using it inside a mixed Java/Kotlin project. 

In my service production code is in Java but tests are in Kotlin, and once I add ErrorProne in the maven-compiler-plugin configuration java code is failing to call into kotlin code with annotations(@JvmStatic). The error is NoClassDefFound. 

This makes me think that the maven compiler plugin is not processing the annotations in the Kotlin code. I am not sure however to make it work, do you have an idea? Or is this more of a question to kotlin maven compiler plugin maintainers?

Thanks
Dmitry

Kurt Nelson

unread,
May 4, 2020, 12:23:00 PM5/4/20
to error-pro...@googlegroups.com
Detekt is going to be your best option for errorprone-use-cases in Kotlin.
Right now it is standalone, but we are working on moving it to be a Kotlin compiler plugin.

We've then created shared configuration classes that are consumed by our EP and Detekt method banning checkers.

--
Googlers: This an external list. Please be careful when posting.
---
You received this message because you are subscribed to the Google Groups "error-prone-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to error-prone-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/error-prone-discuss/CALVbbE8wDtq9AwARBLukit_1ROTwdskb0S0hTZbZS4vZfmfYxA%40mail.gmail.com.

Dmitrii Sergeev

unread,
May 4, 2020, 12:29:53 PM5/4/20
to error-pro...@googlegroups.com
Hi Kurt,

Thanks for getting back to me.

My goal is not to analyze Kotlin source files, but to make it work for Java code in an application that mixes both languages.

Our newer services are already using Detekt and it's wonderful, thank you for making it.

Thanks

Dmitrii Sergeev

unread,
May 5, 2020, 4:07:39 AM5/5/20
to error-prone-discuss
I think my problem is not actually about error prone. It's a general problem of using annotation processors in Java+Kotlin projects. If I compile Java first and then Kotlin then Kotlin can interact with Java but not the other way around. 


On Monday, 4 May 2020 18:29:53 UTC+2, Dmitrii Sergeev wrote:
Hi Kurt,

Thanks for getting back to me.

My goal is not to analyze Kotlin source files, but to make it work for Java code in an application that mixes both languages.

Our newer services are already using Detekt and it's wonderful, thank you for making it.

Thanks

On Mon, 4 May 2020 at 18:23, 'Kurt Nelson' via error-prone-discuss <error-prone-discuss@googlegroups.com> wrote:
Detekt is going to be your best option for errorprone-use-cases in Kotlin.
Right now it is standalone, but we are working on moving it to be a Kotlin compiler plugin.

We've then created shared configuration classes that are consumed by our EP and Detekt method banning checkers.

On Mon, May 4, 2020, 08:32 'Dmitrii Sergeev' via error-prone-discuss <error-prone-discuss@googlegroups.com> wrote:
Hi

First, I wanted to say thank you for developing ErrorProne, it's a very nifty tool.

I have a question about using it inside a mixed Java/Kotlin project. 

In my service production code is in Java but tests are in Kotlin, and once I add ErrorProne in the maven-compiler-plugin configuration java code is failing to call into kotlin code with annotations(@JvmStatic). The error is NoClassDefFound. 

This makes me think that the maven compiler plugin is not processing the annotations in the Kotlin code. I am not sure however to make it work, do you have an idea? Or is this more of a question to kotlin maven compiler plugin maintainers?

Thanks
Dmitry

--
Googlers: This an external list. Please be careful when posting.
---
You received this message because you are subscribed to the Google Groups "error-prone-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to error-prone-discuss+unsub...@googlegroups.com.

--
Googlers: This an external list. Please be careful when posting.
---
You received this message because you are subscribed to the Google Groups "error-prone-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to error-prone-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages