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

 ##########
 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("\\.");
+                int major = Integer.parseInt(javaVersionElements[1]);
 
 Review comment:
   This looks only sane on the old version scheme 1.X.Y. As shown above, the 
version scheme is shifting...

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to