Serialization

Mark Thornton mthornton at optrak.co.uk
Wed Dec 16 04:32:40 PST 2009


Peter Levart wrote:
> On Wednesday 16 December 2009 13:06:59 Mark Thornton wrote:
>   
>> Peter Levart wrote:
>>     
>>> Bytecode can be obtained from closure's class' classloader.
>>>
>>> Peter
>>>   
>>>       
>> That will need a change to the existing API.
>>
>> Mark Thornton
>>
>>
>>     
>
> Using existing API, this should allways work:
>
> #void() someClosure = #() { ... };
>
> URL bytecode = someClosure.getClass().getClassLoader().getResource(someClosure.getClass().getName().replace('.', '/') + ".class");
>
>
> Peter
>   
I can't find anything in the documentation that *guarantees* that will 
work. Nothing seems to prevent a ClassLoader from using separate spaces 
for classes and regular resources.

Mark Thornton



More information about the lambda-dev mailing list