-
Notifications
You must be signed in to change notification settings - Fork 5
package-info should not be reported as dead code #25
Comments
What is in those classes? Is it documentation only? Put it into I wouldn't ignore them by default; maybe provide a configuration parameter to ignore them... |
In my specific case, those are used to specify JSR305 annotations at package level. Reading the JLS section 7.4.1 leads me to think that there is no valid use case having an actual class in a I would not want to mark code annotated with JSR305 as live, as this is not the case. |
Ah, I see (using JSR305). You're right in that deadcode4j may be misleading since it treats package-info.java files as classes (although I believe the compiler really creates a class for such files); the idea behind that is to determine if such files could be removed as well (no matter if they result in a class file or not). E.g. by applying a script that removes specific annotations (or similar automated file manipulations), one could end up with a leftover package-info.java file that no longer serves any purpose - and deadcode4j tries to identify such "unnecessary" files. |
Ok, I see the point. I'm not sure what solution would make sense in that case... Using the JSR305 to tag them as live does not seem right, since "real" classes could also be tagged with JSR305 and be dead. I don't know enough about deadcode4j to propose a solution, I just know enough to see that there is a problem... sorry :) |
No worries, this is simply a scenario I didn't run into yet, but it is valid by its own right. One could easily add an option to ignore |
deadcode4j reports that
package-info
as unused classes. Those should probably be excluded from analysis.The text was updated successfully, but these errors were encountered: