AutoValuePlugin icon indicating copy to clipboard operation
AutoValuePlugin copied to clipboard

Update Auto Value generated Methods ignores super classes

Open MajorTuvok opened this issue 7 years ago • 0 comments

I have the following classes: ` @Immutable public abstract class InetSocketConfig { public abstract int getPort();

public abstract int getReceiveBufferSize();

public abstract int getSendBufferSize();

public abstract int getConnectionTime();

public abstract int getLatency();

public abstract int getBandwith();

public abstract boolean isOOBInLine();

public abstract boolean isReuseAddress();

public abstract int getSoTimeout();

}`

`@AutoValue @CopyAnnotations @Immutable public abstract class ClientInetSocketConfig extends InetSocketConfig {

public abstract String getName();

public static Builder builder() {
    return new AutoValue_ClientInetSocketConfig.Builder();
}

@NotThreadSafe
@AutoValue.Builder
@CopyAnnotations
public static abstract class Builder  {

    public abstract Builder setName(String newName);

    public abstract ClientInetSocketConfig build();
}

}`

`@AutoValue @CopyAnnotations @Immutable public abstract class ServerInetSocketConfig extends InetSocketConfig { public abstract int getBacklog();

@Nullable
public abstract InetAddress getBindAddress();

public static Builder builder() {
    return new AutoValue_ServerInetSocketConfig.Builder();
}


@AutoValue.Builder
@NotThreadSafe
@CopyAnnotations
public abstract static class Builder {
    public abstract Builder setBacklog(int newBacklog);

    public abstract Builder setBindAddress(InetAddress newBindAddress);

    public abstract ServerInetSocketConfig build();
}

}`

The Builder were generated using generate Builder (except of course the Annotations I added), however they ignore the Methods defined in the common super class InetSocketConfig...

My workaround for now is to temporarily annotate InetSocketConfig with AutoValue generate myself a Builder from it and make the subclasses-Builder extend it. Afterwards I remove the AutoValue annotations again.

Some mechanic to cover this case would be nice.

Edit: I don't know what went wrong with the insert code...?!?

MajorTuvok avatar Aug 23 '18 09:08 MajorTuvok