matthiasblaesing commented on code in PR #5317:
URL: https://github.com/apache/netbeans/pull/5317#discussion_r1081846702


##########
harness/o.n.insane/src/org/netbeans/insane/model/InsaneConverter.java:
##########
@@ -351,8 +351,8 @@ private void compute() {
         objsOffset = currentOffset;
         
         // compute offsets of instances
-        for (Iterator<InstanceInfo> it = instanceInfo.iterator(); 
it.hasNext(); ) {
-            InstanceInfo info = it.next();
+        for (Iterator it = instanceInfo.iterator(); it.hasNext(); ) {
+            InstanceInfo info = (InstanceInfo)it.next();

Review Comment:
   The compilation error is caused by using the wrong generics in `ObjectSet`, 
you reverted the introduced generic. Exactly these kind of problems are the 
reason to be very careful to quickly introduce generics, there is a high 
chance, that it will be not the right type.



##########
harness/o.n.insane/src/org/netbeans/insane/model/BinaryHeapModel.java:
##########
@@ -49,7 +49,7 @@ public static HeapModel open(File file) throws Exception {
         // mmap it
         long len = data.length();
         buffer = new 
FileInputStream(data).getChannel().map(FileChannel.MapMode.READ_ONLY, 0, len);
-        System.err.println("magic=" + buffer.getInt(0));
+        System.err.println("magic=" + buffer.getInt(0)); // shouldn't this be 
replaced with logging statement?

Review Comment:
   Please don't add questions - it is useless.



##########
harness/o.n.insane/src/org/netbeans/insane/scanner/ScannerUtils.java:
##########
@@ -233,58 +231,22 @@ public void run() {
         if (ret[0] != null) throw ret[0];
     }
     
-    private static Thread[] getAllThreads() {
-        ThreadGroup act = Thread.currentThread().getThreadGroup();
-        while (act.getParent() != null) act = act.getParent();
-        Thread[] all = new Thread[2*act.activeCount()+5];
-        int cnt = act.enumerate(all);
-        Thread[] ret = new Thread[cnt];
-        System.arraycopy(all, 0, ret, 0, cnt);
-        return ret;
-    }
-
-    @SuppressWarnings("deprecation")
-    private static void suspendAllThreads(Set<Thread> except) {
-        Thread[] threads = getAllThreads();
-        
-        for (int i=0; i<threads.length; i++) {
-            if (!except.contains(threads[i])) {
-                if ((threads[i].getName().indexOf("VM") == -1) &&
-                (threads[i].getName().indexOf("CompilerTh") == -1) &&
-                (threads[i].getName().indexOf("Signal") == -1)) {
-                    System.out.println("suspending " + threads[i]);
-                    threads[i].suspend();
-                }
-            }
-        }
-    }
-    
-    @SuppressWarnings("deprecation")
-    private static void resumeAllThreads() {
-        Thread[] threads = getAllThreads();
-        
-        for (int i=0; i<threads.length; i++) {
-            threads[i].resume();
-        }
-    }
-    
     private static class ClassInfo {
-        private static Map<Class, ClassInfo> classInfoRegistry = new 
WeakHashMap<Class, ClassInfo>();
-        private int size;
+        private static final Map<Class<?>, ClassInfo> classInfoRegistry = new 
WeakHashMap<>();
+        private final int size;
         
-        private ClassInfo(Class cls) {
-//            this.cls = cls;
+        private ClassInfo(Class<?> cls) {
             if (cls.isArray()) {
-                Class base = cls.getComponentType();
+                Class<?> base = cls.getComponentType();
                 size = -getSize(base, true);
             } else {
                 // iterate all fields and sum the sizes
                 int sum = 0;
-                for (Class act = cls; act != null; act = act.getSuperclass()) {
-                    Field[] flds = act.getDeclaredFields();
-                    for (int i=0; i<flds.length; i++) { // count all nonstatic 
fields
-                        if ((flds[i].getModifiers() & Modifier.STATIC) == 0) {
-                            sum += getSize(flds[i].getType(), false);
+                for (Class<?> act = cls; act != null; act = 
act.getSuperclass()) {
+                    // count all nonstatic fields

Review Comment:
   The comment in line 246 did not exist before, the variable `sum` is 
self-explanatory and the comment in line 243 gives all context, that is needed. 
This new comment is just wrong. The loop does not count, it sums.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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