You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2019/05/07 21:05:07 UTC

[GitHub] [netbeans] jlahoda commented on issue #1236: [NETBEANS-2514] - remove sun.misc.Unsafe

jlahoda commented on issue #1236: [NETBEANS-2514] - remove sun.misc.Unsafe
URL: https://github.com/apache/netbeans/pull/1236#issuecomment-490254911
 
 
   So, let us think on why there was a use of Unsafe in the first place. The reason was that, when the ability to use javac from JDK instead of the nb-javac fork was added, the use of javac's APIs that were JDK 9 specific (and were in nb-javac) was way too widespread, and it was simply unfeasible to make the Java support work using javac from JDK 8. So, the Java editing features in NetBeans can run with nb-javac installed on JDK 8+, or using javac from JDK (without nb-javac) on JDK 9+, but not using JDK's javac on JDK 8. But it was desirable that the IDE is able to start, and does not crash too hard when running without nb-javac on JDK 8. One step to achieve that was to inject the WriteableScope (which is in JDK 9, but not in JDK 8, and is used somewhere too hard/early in the Java support in NB, I don't recall where exactly). One thing to note is that this is neither necessary nor done on JDK 9+. So it seemed (and still seems to me) OK to use Unsafe.defineClass. After all, I don't think there is a better way to do that in JDK 8.
   
   In any case, using MethodHandles.Lookup.defineClass(byte[]), which is (AFAIK) @since 9, feels useless to me.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists