commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno P. Kinoshita (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-621) ReflectionToStringBuilder.toString does not debug 3rd party object fields within 3rd party object
Date Wed, 12 Feb 2014 19:21:27 GMT

    [ https://issues.apache.org/jira/browse/LANG-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13899457#comment-13899457
] 

Bruno P. Kinoshita commented on LANG-621:
-----------------------------------------

Tested LANG-621.patch locally, and it is looking neat. 

Running the code provided in the issue description before the patch: 

{code}org.apache.commons.lang3.Reflect$Compound@6d06d69c[instanceInt=67890,fixture=org.apache.commons.lang3.Reflect$Simple@4e25154f]{/code}

After the patch:

{code}org.apache.commons.lang3.Reflect$Compound@6d06d69c[instanceInt=67890,fixture=org.apache.commons.lang3.Reflect$Simple@677327b6[instanceInt=12345]]{/code}

Built the site and everything looks fine. There are no tests with collections in the Person
object. By adding:

{code}
/**
  * Test Collection field.
  */
List<String> hobbies = Arrays.asList("painting", "cooking"); 
{/code}

To the test Person class, the line coverage goes from 63% to 100%.

Everything else looks great.

> ReflectionToStringBuilder.toString does not debug 3rd party object fields within 3rd
party object
> -------------------------------------------------------------------------------------------------
>
>                 Key: LANG-621
>                 URL: https://issues.apache.org/jira/browse/LANG-621
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.builder.*
>    Affects Versions: 2.5
>            Reporter: Philip Hodges
>            Priority: Minor
>             Fix For: Review Patch
>
>         Attachments: LANG-621.patch
>
>
> {code:title=Reflect.java|borderStyle=solid}
> 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;
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message