For an immutable object, a hashcode value & toString value only need to be computed once and cached. Then the hashcode and toString methods can just return the cached values.
The @ToString and @EqualsAndHashCode ast transformation should have options to allow for caching. For example:
Also, the @Immutable annotation should use the @ToString and @EqualsAndHashCode transformation with this caching capability enabled.