That’s a bit of a straw man.
1. You are using go’s built in imaginary type, and writing one from scratch in Java.
2. That is no longer idiomatic Java. Use Autovalue and the comparison is a little more fair. The LOC and complexity still come out in go’s favor for this, no doubt.
3. Beating down on Java is fun, but with Kotlin interop and adoption rate, I think the comparison will become JVM vs X.
I think you are misunderstanding the linked code. The imaginary type in the Go case is not build in.