Re: Issue with BuiltinClassLoader.ucp field not being visible

2021-08-10 Thread Luke Hutchison
On Tue, Aug 10, 2021 at 1:34 AM Luke Hutchison  wrote:

> Maybe that should be part of the Instrumentation class, so that it is only
> accessible to Java agent code that is able to get a reference to an
> Instrumentation object.
>

Actually I take that last part back, that would not be very helpful to
libraries like ClassGraph. It would be much better if there were simply a
public method in `AppClassLoader` that could be used to get all classpath
elements that have been added for instrumentation.


Re: Issue with BuiltinClassLoader.ucp field not being visible

2021-08-10 Thread Alan Bateman

On 10/08/2021 07:58, Luke Hutchison wrote:

On Tue, Aug 10, 2021 at 12:51 AM Luke Hutchison 
wrote:


Could a getURLClassPath() method please be added to BuiltInClassLoader?


For security reasons, the getURLClassPath() method should return a copy of
ucp, not the reference to ucp, to prevent the caller from modifying the
system classpath.
I think you need more context here. This a JDK internal class so 
shouldn't be used directly. It reads like the original message was 
looking for the value of java.class.path as a sequence of URLs, is that 
right?


-Alan


Re: Issue with BuiltinClassLoader.ucp field not being visible

2021-08-10 Thread Luke Hutchison
On Tue, Aug 10, 2021 at 12:51 AM Luke Hutchison 
wrote:

> Could a getURLClassPath() method please be added to BuiltInClassLoader?
>

For security reasons, the getURLClassPath() method should return a copy of
ucp, not the reference to ucp, to prevent the caller from modifying the
system classpath.