MethodHandles.Lookup.defineResource?

Alan Bateman Alan.Bateman at oracle.com
Mon Aug 27 06:52:55 UTC 2018


On 14/08/2018 15:07, Stephen Colebourne wrote:
> A new method MethodHandles.Lookup defineClass() was added recently.
> But what about a defineResource? For adding a new resource to the
> classpath (such as a .txt file). I just needed such a thing, and
> though undoubtedly rare, all the recommended solutions use reflection
> and setAccessible().
>
It might be useful to expand on your use-case a bit more. It may be that 
you are really just looking to create a ClassLoader that can locate a 
resource that you generate at run-time. Also the mention of core 
reflection and setAccessible isn't clear as they aren't used with resources.

-Alan


More information about the core-libs-dev mailing list