Re: ToString does not seem to work for me

Dani Mező <[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <CAKxP=D59gCwhe7Hkb5JpgBkU07Ysg6xHDptv4njR8CYswH++9A@mail.gmail.com>
Ahhhhh, nevermind, my Card.groovy was a Card.java, and ToString just had no
effect I guess.

Dani Mező <[email protected]> ezt írta (időpont: 2023. jan. 19., Cs,
14:01):

> Hi fellow devs,
>
> I ran into a problem, where ToString() does not work for me, I'd like to
> post here before I open a bug ticket, I am sure I did something wrong.
> My classes below.
>
> Main.groovy:
>
> class Main {
>     static void main(args) {
>         println(new Card(name: "hey"))
>     }
> }
>
> Card.groovy:
>
> import groovy.transform.ToString;
>
> @ToString
> class Card {
>     String name;
> }
>
> My output:
>
> Card@43f02ef2
>
> I expected the class to be pretty printed into my console, but that is not
> the case.
> What do I do wrong?
>
> I am building with
> Intellij 2020.3.2
> Groovy 3.0.7
> OpenJDK 15.0.2
>
> Any suggestions?
>
> Cheers, Daniel
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.