Eugen Martynov
04/11/2025, 10:07 AMGenerated
substring in the annotation name. Is it possible to overcome?Matteo Mirk
04/15/2025, 12:31 PMEugen Martynov
04/15/2025, 1:05 PMGenerated
substring.Eugen Martynov
04/15/2025, 1:07 PMMatteo Mirk
04/15/2025, 1:10 PMEugen Martynov
04/15/2025, 1:11 PMEugen Martynov
04/15/2025, 1:11 PMEugen Martynov
04/15/2025, 1:11 PMGenerated
to our annotationEugen Martynov
04/15/2025, 1:12 PMMatteo Mirk
04/15/2025, 1:15 PMMatteo Mirk
04/15/2025, 1:16 PMSo there is just annotation name operatingnot only, the annotation declaration must have retention RUNTIME or CLASS
Eugen Martynov
04/15/2025, 1:17 PMEugen Martynov
04/15/2025, 1:17 PMEugen Martynov
04/15/2025, 1:18 PMEugen Martynov
04/15/2025, 1:23 PMMatteo Mirk
04/16/2025, 7:31 AMexcludes
glob path, like com/foo/bar/preview/**
? If you can locate such code under the same package you can exclude it easier without annotationsMatteo Mirk
04/16/2025, 8:36 AM**/*Preview.class
(remember Jacoco analyzes bytecode not source)Eugen Martynov
04/16/2025, 9:12 AMMatteo Mirk
04/16/2025, 9:32 AMEugen Martynov
04/16/2025, 9:38 AMMatteo Mirk
04/16/2025, 10:02 AM@Composable
generates additional bytecode upon compilation, that includes your regular and preview functions. The above fix indeed excludes that generated bytecode from coverage. Again, Jacoco doesn't analyze your source code, only the bytecode, that's why it reports code that you can't (or won't) reach with a test as not covered. You can try it for yourself, either by employing the "excludes" settings I propsed or by using a SNAPSHOT version of Jacoco and check if it works on your coverage. Or you can not trust me and argue here all day, it's your choice.