You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2015/05/28 13:43:18 UTC

[jira] [Commented] (GROOVY-7438) @ToString(includeSuperProperties = true) does not work

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

Paul King commented on GROOVY-7438:
-----------------------------------

This works for me on master and 2.4.3:
{code}
import groovy.transform.*
@CompileStatic
abstract class UploadPermission implements Serializable {
    String id
    String uploader
    String target
}

@ToString(includeNames = true, includeSuperProperties = true)
@CompileStatic
class DigitizerOnboardPermission extends UploadPermission {
    boolean createdAccount
}

assert GroovySystem.version == '2.4.3'
assert new DigitizerOnboardPermission(createdAccount:false).toString() ==
  'DigitizerOnboardPermission(createdAccount:false, id:null, uploader:null, target:null)'
{code}
Can you try running and see what you get?

> @ToString(includeSuperProperties = true) does not work
> ------------------------------------------------------
>
>                 Key: GROOVY-7438
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7438
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.3
>            Reporter: Christopher Smith
>            Priority: Minor
>
> The annotation option added as a resolution to GROOVY-7161 does not work for me. I've tried numerous combinations of options on both the superclass and the subclass and only ever see properties from the subclass (or the entire {{super}} block).
> {code}
> @ToString(includePackage = false, includeNames = true)
> @CompileStatic
> abstract class UploadPermission implements Serializable {
>     private static final long serialVersionUID = 1L
>     @Id
>     String id
>     @Indexed
>     @NotEmpty
>     String uploader
>     @Indexed
>     @NotEmpty
>     String target
> }
> {code}
> {code}
> @ToString(includePackage = false, includeNames = true, includeSuperProperties = true)
> @CompileStatic
> class DigitizerOnboardPermission extends UploadPermission {
>     boolean createdAccount
> }
> {code}
> Output:
> {code}
> DigitizerOnboardPermission(createdAccount:false)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)