You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2021/02/15 04:11:29 UTC

[groovy] branch master updated: remove old comments

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new baaa793  remove old comments
baaa793 is described below

commit baaa793b6dc858e6b0cb771ac0e5ba2a83a21703
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Feb 15 14:11:04 2021 +1000

    remove old comments
---
 .../groovy/runtime/DefaultGroovyMethods.java       | 32 +---------------------
 1 file changed, 1 insertion(+), 31 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index e44fccd..0331c45 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -438,7 +438,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
 
     /**
      * Generates a detailed dump string of an object showing its class,
-     * hashCode and fields.
+     * hashCode and all accessible fields.
      *
      * @param self an object
      * @return the dump representation
@@ -455,10 +455,6 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
         buffer.append(Integer.toHexString(self.hashCode()));
         boolean groovyObject = self instanceof GroovyObject;
 
-        /*jes this may be rewritten to use the new getProperties() stuff
-         * but the original pulls out private variables, whereas getProperties()
-         * does not. What's the real use of dump() here?
-         */
         while (klass != null) {
             for (final Field field : klass.getDeclaredFields()) {
                 if ((field.getModifiers() & Modifier.STATIC) == 0) {
@@ -483,32 +479,6 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
             klass = klass.getSuperclass();
         }
 
-        /* here is a different implementation that uses getProperties(). I have left
-         * it commented out because it returns a slightly different list of properties;
-         * i.e. it does not return privates. I don't know what dump() really should be doing,
-         * although IMO showing private fields is a no-no
-         */
-        /*
-        List props = getProperties(self);
-            for(Iterator itr = props.keySet().iterator(); itr.hasNext(); ) {
-            String propName = itr.next().toString();
-
-            // the original skipped this, so I will too
-            if(pv.getName().equals("class")) continue;
-            if(pv.getName().equals("metaClass")) continue;
-
-            buffer.append(" ");
-            buffer.append(propName);
-            buffer.append("=");
-            try {
-                buffer.append(InvokerHelper.toString(props.get(propName)));
-            }
-            catch (Exception e) {
-                buffer.append(e);
-            }
-        }
-        */
-
         buffer.append(">");
         return buffer.toString();
     }