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 19:56:32 UTC

[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #1236: [NETBEANS-2514] - remove sun.misc.Unsafe

matthiasblaesing commented on a change in pull request #1236: [NETBEANS-2514] - remove sun.misc.Unsafe
URL: https://github.com/apache/netbeans/pull/1236#discussion_r281805154
 
 

 ##########
 File path: java/java.source.base/src/org/netbeans/modules/java/source/NoJavacHelper.java
 ##########
 @@ -69,35 +68,20 @@ public void run() {
                 w.visit(Opcodes.V1_8, Opcodes.ACC_ABSTRACT | Opcodes.ACC_PUBLIC, "com/sun/tools/javac/code/Scope$WriteableScope", null, "com/sun/tools/javac/code/Scope", null);
                 byte[] classData = w.toByteArray();
 
-                String JavaVersion = System.getProperty("java.specification.version"); //NOI18N
-                boolean isJdkVer8OrBelow = true;
-                if (!JavaVersion.startsWith("1.")) {   //NOI18N
-                    isJdkVer8OrBelow = false;
-                }
-                if (isJdkVer8OrBelow) {
-                    try {
-                        Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); //NOI18N
-                        theUnsafe.setAccessible(true);
-                        Unsafe unsafe = (Unsafe) theUnsafe.get(null);
+                String[] javaVersionElements = System.getProperty("java.version").split("\\.");
 
 Review comment:
   Sorry - this will break with newer version of Java: `java.version = 13-ea`
   `
   

----------------------------------------------------------------
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