Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Auto Value generated Methods ignores super classes #30

Open
MajorTuvok opened this issue Aug 23, 2018 · 0 comments
Open

Update Auto Value generated Methods ignores super classes #30

MajorTuvok opened this issue Aug 23, 2018 · 0 comments

Comments

@MajorTuvok
Copy link

MajorTuvok commented Aug 23, 2018

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...?!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant