I didn't had dead code in mind. And as Remi explained it cannot be detected on a jar-base, only on an application base. (which reminds me that we also need to have a look at the minimizeJar option of the maven-shade-plugin). My idea was more about collecting all classes required to compile the sourcefiles and verify that of all required modules at least one class is used. In case of "transitive" it should also verify the method-signatures. And yes, in this case I assume that modules which classes are accessed by reflection are optional, which sounds fair enough to me.


On Mon, 17 Oct 2016 13:06:59 +0200, Remi Forax <fo...@univ-mlv.fr> wrote:

The compiler can not detect dead code because it can be a library.
jlink can detect dead code and provide a list of unneeded modules because it has the view of the whole application.


On October 17, 2016 10:45:26 AM GMT+02:00, Andrew Haley <a...@redhat.com> wrote:
On 16/10/16 19:52, Robert Scholte wrote:

To enforce the discipline, the java compiler should IMHO at least
check if all required modules are indeed required and if the
transitive required modules are indeed transitive.

How can the compiler possibly know this?  There are ways of requiring
a module without naming it in a declaration.


Reply via email to