Hi Mark,

unsafe is used in all frameworks so i'd consider it as safe ;)

Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2012/12/31 Mark Struberg <strub...@yahoo.de>:
> hi folks!
>
> While looking at the ASM proxy David imported to OWB I saw that it's based on 
> the sun.misc.Unsafe class.
> This makes this approach non-portable to other JVMs.
>
> I now played around with an alternative way to do the same: I just invoke the 
> protected ClassLoader#defineClass method via reflection instead. In my tests 
> this works pretty well already. See defineAndLoadClass in  [1]. Maybe I can 
> even remove the 2nd explicit loadClass. It also works without in java6 but 
> the docs says that the class is only available after doing a loadClass. Would 
> need some more tests to make sure it also works portable without this 
> redundant call.
>
> Happy about any feedback.
>
>
> LieGrue,
> strub
>
>
> [1] 
> http://svn.apache.org/repos/asf/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/asm/InterceptorDecoratorProxyFactory.java
>

Reply via email to