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

SseEvent.Builder::build returns ImmutableSseEvent instead of SseEvent #12

Closed
buckett opened this issue Nov 2, 2019 · 1 comment
Closed

Comments

@buckett
Copy link
Contributor

buckett commented Nov 2, 2019

When building an event I use

SseEvent.builder().data(data)....build();

and this returns a ImmutableSseEvent which is package private, so not accessible in the calling code. Would it not be better to have the build() call return a SseEvent? I hit this issue because autocomplete in Intellij when I ask it to assign the result of the statement to a variable attempts to create a variable of type ImmutableSseEvent.

@buckett buckett changed the title ch.rasc.sse.eventbus.ImmutableSseEvent.Builder#build SseEvent.Builder::build returns ImmutableSseEvent instead of SseEvent Nov 2, 2019
@ralscha
Copy link
Owner

ralscha commented Nov 2, 2019

I agree. This class should not be visible to the user of the library.

Looks like there is a solution according to the immutables documentation:
http://immutables.github.io/immutable.html#hide-implementation-class

@ralscha ralscha closed this as completed in 709cea8 Nov 2, 2019
ralscha added a commit that referenced this issue Nov 3, 2019
The flag overshadowImplementation changes the return type of the build()
method to the interface type.
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

2 participants