testing for a class having been loaded

Alan Snyder javalists at cbfiddle.com
Wed Nov 30 18:02:53 UTC 2016


All questions are worthy of some study, but I’m not getting why you question the sanity of asking for the status of classes but have no problem with asking for the status of packages.

Do you have some vague sense of possible problems?

  Alan



> On Nov 30, 2016, at 8:45 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> On 30/11/2016 15:51, Alan Snyder wrote:
> 
>> :
>> As Michael said, the hack is using reflection with setAccessible() to call the protected method ClassLoader::findLoadedClass().
>> 
>> Is there some conceptual or security reason to not provide this functionality in a public API?
> It's protected because it's for use in class loader implementations. It is final so it could potentially be changed to public but would require a lot of consideration before going that road. To be honest, the scenario is a bit odd, there must be a saner solution that doesn't involve checking if classes are loaded.
> 
> -Alan



More information about the jigsaw-dev mailing list