deadcode4j v1.4 is out! It is available via Maven central, so it is conveniently available for your Maven project.
What's new?
Version 1.4 was all about customization, so that you can unleash the power of deadcode4j without waiting for the nth feature to be added:
- Additionally to the annotations that can be configured, you can now define interfaces which, if implemented by a class, mark that code as being in use
- With annotations and interfaces, there's only one thing missing: superclasses - and they can be configured as well, thus marking subclasses as being in use
- As deadcode4j processes the whole reactor, there may be some example/testing modules which should not be considered - so now you can specify if a module shouldn't be part of the analysis
This should help you eliminate a good portion of the false positives being found by deadcode4j right now, helping you set up a configuration which recognizes dead code.
Nevertheless, v1.4 brings some more analysis features:
- Classes being listed in
web.xml
files ascontextClass
orcontextInitializerClasses
parameter for Spring'sContextLoader
orFrameworkServlet
are recognized as live code - Hibernate Annotations processing:
- Classes referenced by the
strategy
parameter of a@GenericGenerator
annotation are recognized as live code - Classes referenced by the
type
parameter of a@Type
annotation are recognized as live code - Classes annotated with
@TypeDef
being referenced by a@Type
annotation are recognized as live code package-info
classes annotated with JAXB's@XmlSchema
annotation are recognized as live code- Classes being annotated with any of a bunch of JSF annotations are recognized as live code
*Descriptor
classes being generated by Castor are recognized as live code
How to use
It's so simple: go to the console, navigate to your Maven project, type
mvn de.is24.mavenplugins:deadcode4j-maven-plugin:find ‑Dmaven.test.skip=true
and see what it finds.
Hop on over to GitHub to learn more, browse the code, or contribute.
Looking for reference projects & users
Currently I'm using the big legacy application of my employer as a reference project. But I'm slowly running out of false positives, so my feature list is shrinking. That's why I'd love to analyze some more projects to get more feedback. So, if you know of an (open source) candidate I can analyze or if you are using deadcode4j for yourself and want something added or you have some nice ideas, please comment!
Here you can read how it all started.