-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Kotlin compiler should mark anonymous classes for callable references as synthetic #791
Comments
Generation of class is not caused by
@thimmwork following questions must be answered before considering implementation of filter: why Kotlin compiler adds line numbers into generated class? and most importantly why it is not marked as |
I have just created https://youtrack.jetbrains.com/issue/KT-28453 and will let you know about updates. |
@goodwinnk I noticed that there is already change that marks method as I'm wondering why was decided to keep line number in this method, while you was questioning its necessity in description of KT-28453 ? Could also be noted that the only known to me so far examples of BTW maybe you can point me on other examples of |
@Godin You're right that current behavior is inconsistent. I have created another issue about removing line numbers from |
@goodwinnk thanks! |
@thimmwork could you please try Kotlin 1.3.30 EAP that contains fix for KT-28453 ? According to my tests callable references do not cause partial coverage after this fix. |
@Godin I updated kotlin-maven-plugin and stdlib to 1.3.30-eap-11 and it works. 😃 Thank you very much @goodwinnk and @Godin ! |
Added validation test which shows that after upgrade to Kotlin 1.3.30 callable references do not cause partial coverage - d3c4765 |
Kotlin generates additional classes when using reflection. These classes are neither marked as covered nor filtered out by jacoco.
Steps to reproduce
Add maven dependency
and create a function which gets a reflect.Method reference to a function like this:
when using
.javaMethod
, Kotlin generates an anonymous class which will be checked for line coverage by jacocoJaCoCo version: 0.8.2
Operating system: any (tested on Mac OS 10.13.6 and Ubuntu)
Tool integration: Maven
Expected behaviour
Code generated by Kotlin compiler should be marked as covered or filtered out
Actual behaviour
Line coverage for generated class is 0.00
Rule violated for class SomeController.getAddressWithGeoInformation.javaMethod.1: lines covered ratio is 0.00, but expected minimum is 0.85
This issue may or may not affect other reflection mechanisms as well. I tested only
.javaMethod
as we use this for generating HATEOAS links in our web controller classes.The text was updated successfully, but these errors were encountered: