Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-621

ReflectionToStringBuilder.toString does not debug 3rd party object fields within 3rd party object

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5
    • 3.3
    • lang.builder.*

    Description

      Reflect.java
      import org.apache.commons.lang.builder.ReflectionToStringBuilder;
      
      public class Reflect {
      
          public static void main(String[] args) {
              // "You can also use the builder to debug 3rd party objects:"
              // System.out.println("An object: " + ReflectionToStringBuilder.toString(anObject));
      
              // expected: Reflect$Compound@a83b8a[instanceInt=67890,fixture=Reflect$Simple@1d1acd3[instanceInt=12345]]
              // actual: Reflect$Compound@a83b8a[instanceInt=67890,fixture=Reflect$Simple@1d1acd3]
              System.out.println(ReflectionToStringBuilder.toString(new Compound()));
          }
      
          static class Compound {
              private int instanceInt = 67890;
              private Simple fixture = new Simple();
          }
      
          static class Simple {
              private int instanceInt = 12345;
          }
      
      }
      

      Attachments

        1. LANG-621.patch
          11 kB
          Thomas Neidhart

        Activity

          People

            kinow Bruno P. Kinoshita
            phhodges Philip Hodges
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: