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

Exclude id from NetworkImpl.NetworkImplBuilder (testcontainers#8125) #2807

Merged
merged 5 commits into from Sep 14, 2020

Conversation

quincy
Copy link
Contributor

@quincy quincy commented May 28, 2020

This seemed like an easy issue to get started contributing. I'm a big fan of the project and have been evangelizing it at my company.

@rnorth
Copy link
Member

rnorth commented May 29, 2020

We had some issues with the quay.io docker registry, which caused the build to fail. Will update the branch from master to include #2805.

@quincy
Copy link
Contributor Author

quincy commented May 29, 2020

Thanks @rnorth, I saw quay was having problems again.

@rnorth
Copy link
Member

rnorth commented May 29, 2020

Looks like we have a check failure in the :testcontainers:japicmp task 🤔
We may have a binary backwards compatibility problem to think about here...

@bsideup
Copy link
Member

bsideup commented May 29, 2020

@rnorth we definitely do, because the constructor was public :) Let's make it backward compatible and deprecate first

@quincy
Copy link
Contributor Author

quincy commented May 29, 2020

Assuming you want something like this?

@Deprecated
public NetworkImpl() {}

@bsideup
Copy link
Member

bsideup commented May 29, 2020

@quincy no, the other one ("all args constructor"), with the id

@quincy
Copy link
Contributor Author

quincy commented May 29, 2020

Ah, right, because @Builder would need to create an all-args constructor in order for it to do its job.

@quincy
Copy link
Contributor Author

quincy commented May 29, 2020

That doesn't appear to have fixed the issue. It's still complaining about the removed setter.

@quincy
Copy link
Contributor Author

quincy commented May 29, 2020

Okay, I've pushed a new commit which delomboks the existing builder, and deprecates the id method directly. After this has been released we can go back in and remove the deprecated stuff and throw the @Builder annotation back on.

If you guys know a better way to deal with this through lombok directly, please clue me in. I did not find anything in their documentation which looked promising.

@bsideup
Copy link
Member

bsideup commented May 29, 2020

@quincy I wonder if adding @Deprecated on a field makes it deprecated in the builder, too. Could you please check?

@quincy
Copy link
Contributor Author

quincy commented Jun 1, 2020

@bsideup, yes, marking the field deprecated makes it deprecated in the builder. I believe you are suggesting we could mark the id field deprecated for now and release. Then after the release we can come back and implement my original change to have the builder without the id, and at that point we could remove the deprecated annotation from id.

Let me know if that sounds good, or if you have something else in mind, and I can get that change pushed.

@bsideup
Copy link
Member

bsideup commented Jun 1, 2020

@quincy yes, this definitely sounds good 👍

The field is deprecated in order to mark the NetworkBuildImpl#id method
deprecated so that the method can later be removed.  We'll undeprecate the
field at that time.
@quincy
Copy link
Contributor Author

quincy commented Jun 11, 2020

@bsideup, @rnorth,

Was there anything else you guys wanted me to do on this branch at the moment?

@bsideup
Copy link
Member

bsideup commented Jun 11, 2020

@quincy thanks for the ping. I guess we should also override getId and not mark it as deprecated, because the getter is definitely not :)

@quincy
Copy link
Contributor Author

quincy commented Jun 11, 2020

@bsideup, the getter is already overridden.

        @Override
        public synchronized String getId() {
            if (initialized.compareAndSet(false, true)) {
                id = create();
            }

            return id;
        }

I am not really familiar with lombok so I am not sure how to solve that. Any suggestions?

@quincy quincy mentioned this pull request Jun 14, 2020
@stale
Copy link

stale bot commented Sep 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this.

@stale stale bot added the stale label Sep 11, 2020
@stale stale bot removed the stale label Sep 11, 2020
@quincy
Copy link
Contributor Author

quincy commented Sep 11, 2020

I got quite a bit more busy so I kind of lost track of this, but I'm still interested in finishing this PR. I'm not sure what the best way forward is though, are there any suggestions about how to deal with the getter being marked deprecated?

@rnorth
Copy link
Member

rnorth commented Sep 12, 2020

I think the PR is having the desired effect:
image

I'm going to approve but not merge; @bsideup if you think this is missing something still please say.

@bsideup bsideup merged commit 2be4c2a into testcontainers:master Sep 14, 2020
@bsideup
Copy link
Member

bsideup commented Sep 14, 2020

@quincy @rnorth looks good! 💯

@bsideup bsideup added this to the next milestone Sep 14, 2020
@bsideup bsideup added the type/deprecation Public APIs are being deprecated but not changed yet label Sep 14, 2020
@quincy
Copy link
Contributor Author

quincy commented Sep 14, 2020

Thanks @bsideup , @rnorth !

@quincy quincy deleted the testcontainers-java-2185 branch September 14, 2020 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution/acknowledged type/deprecation Public APIs are being deprecated but not changed yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants