Skip to content

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

Merged
bsideup merged 5 commits into
testcontainers:masterfrom
quincy:testcontainers-java-2185
Sep 14, 2020
Merged

Exclude id from NetworkImpl.NetworkImplBuilder (testcontainers#8125)#2807
bsideup merged 5 commits into
testcontainers:masterfrom
quincy:testcontainers-java-2185

Conversation

@quincy

@quincy quincy commented May 28, 2020

Copy link
Copy Markdown
Contributor

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

rnorth commented May 29, 2020

Copy link
Copy Markdown
Member

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

quincy commented May 29, 2020

Copy link
Copy Markdown
Contributor Author

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

@rnorth

rnorth commented May 29, 2020

Copy link
Copy Markdown
Member

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

bsideup commented May 29, 2020

Copy link
Copy Markdown
Member

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

@quincy

quincy commented May 29, 2020

Copy link
Copy Markdown
Contributor Author

Assuming you want something like this?

@Deprecated
public NetworkImpl() {}

@bsideup

bsideup commented May 29, 2020

Copy link
Copy Markdown
Member

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

@quincy

quincy commented May 29, 2020

Copy link
Copy Markdown
Contributor Author

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

@quincy

quincy commented May 29, 2020

Copy link
Copy Markdown
Contributor Author

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

@quincy

quincy commented May 29, 2020

Copy link
Copy Markdown
Contributor Author

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

bsideup commented May 29, 2020

Copy link
Copy Markdown
Member

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

@quincy

quincy commented Jun 1, 2020

Copy link
Copy Markdown
Contributor Author

@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

bsideup commented Jun 1, 2020

Copy link
Copy Markdown
Member

@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
quincy force-pushed the testcontainers-java-2185 branch from dc343ea to 0c4dcfb Compare June 1, 2020 12:53
@quincy

quincy commented Jun 11, 2020

Copy link
Copy Markdown
Contributor Author

@bsideup, @rnorth,

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

@bsideup

bsideup commented Jun 11, 2020

Copy link
Copy Markdown
Member

@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

quincy commented Jun 11, 2020

Copy link
Copy Markdown
Contributor Author

@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

stale Bot commented Sep 11, 2020

Copy link
Copy Markdown

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

quincy commented Sep 11, 2020

Copy link
Copy Markdown
Contributor Author

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

rnorth commented Sep 12, 2020

Copy link
Copy Markdown
Member

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

bsideup commented Sep 14, 2020

Copy link
Copy Markdown
Member

@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

quincy commented Sep 14, 2020

Copy link
Copy Markdown
Contributor Author

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.

3 participants