JDeps: detecting offending packages

Robert Scholte rfscholte at apache.org
Fri Nov 13 21:58:47 UTC 2015


Hi,

for the maven-jdeps-plugin I use the following code to detect offending  
packages:
---
import java.io.IOException;

import org.codehaus.plexus.util.StringUtils;

public class Base64Codec
{

     @SuppressWarnings( "restriction" )
     public static byte[] Base64decode( String input ) throws IOException
     {
         if( StringUtils.isNotEmpty( input ) )
         {
             return new sun.misc.BASE64Decoder().decodeBuffer( input );
         }
         else
         {
             return null;
         }
     }
}
---

Previous versions of JDK9 gave me the following output:

classes -> java.base
    <unnamed> (classes)
       -> java.io
       -> java.lang
       -> sun.misc                                           JDK internal  
API (java.base)


The current b86 gives me:

classes -> java.base
    <unnamed> (classes)
       -> java.io
       -> java.lang
       -> sun.misc

So why this change? And is there another way to detect the usage of  
non-accessible classes?

The maven-plugin has a parameter called failOnWarning (default:true) which  
should break the build in order to help developers to change their code  
when they rely on internal classes.

regards,
Robert Scholte


More information about the jigsaw-dev mailing list