bmuschko / gradle-clover-plugin

Gradle plugin for generating a code coverage report using Clover
Apache License 2.0
74 stars 49 forks source link

Make compilerArgs configurable #98

Closed prestontim closed 7 years ago

prestontim commented 7 years ago

I received a report from a developer in my company that's encountering an issue while attempting to write some unit tests for a Spring Boot app. The test in question is attempting to exercise some code that's utilizing the @PreAuthorize annotation and is getting the following message:

Unable to resolve method parameter names for method: public java.lang.String com.example.api.TestApi.get(java.lang.Long). Debug symbol information is required if you are using parameter names in expressions.

However, even with debug enabled in Clover, it's not sufficient for the test to pass. It's only when I explicitly added the "-parameters" compiler argument, that I could get the test to pass with Clover. compilerargs

Sample app contains a test that will pass when the Clover-related lines are commented out and will fail when Clover is applied/configured. sample.zip

Alex-Vol commented 7 years ago

Thank you for the report and the sample app. I will take a look at this soon. Since you already have a possible solution I can look into extending the DSL to have a compilerArgs option that can contain the raw additional arguments that make this work. Seems that there are more nuances to the reflection based application frameworks that must be cared for.