import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.Base64;

public final class Reproduction implements Serializable {
    private static final long serialVersionUID = 0;
    private static final String SERIALIZED =
            "rO0ABXNyAAxSZXByb2R1Y3Rpb24AAAAAAAAAAAIAAUwABXZhbHVldAASTGphdmEvbGFuZy9TdHJpbmc7eHB0ACQ4NzE2MDY2ZS0xMjY4LTQ0MWQtYmM5Yi1hOWY4ZDFjOTdhZGU=";

    private static final String RANDOM_STRING = "this should not be printed";

    // To switch behaviour, comment the below line and uncomment the line below that.
    // private final String value = randomConstant();
    private final String value = RANDOM_STRING;

    private static String randomConstant() {
        return RANDOM_STRING;
    }

    public String toString() {
        return value;
    }

    public static void main(String[] args) throws Exception {
        byte[] data = Base64.getDecoder().decode(SERIALIZED);
        try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data))) {
            Reproduction repro = (Reproduction) ois.readObject();
            System.out.println(repro.value);
            System.out.println(Reproduction.class.getDeclaredField("value").get(repro));
        }
    }
}
