The only way I know to address this obnoxious issue is to create your
own custom RMIClassLoaderSpi and install it early enough.
The custom RMIClassLoaderSpi is very simple:
public String getClassAnnotation( final Class cl )
{
return ( null ); // we don't need no stinking bloated RMI
class annotations!
}
otherwise the implementation can simply default to
DefaultSpiHolder.instance.getDefaultSpi().
Of course, it is extremely silly that this issue has existed for many
years and there's still no simple -Djava.rmi.disableClassAnnotations or
the like.