Skip to content

Conversation

@stephengold
Copy link
Member

This addresses issue #1676, changing the return types of 13 clone() methods to the class in which they're declared.

This is technically an API change. The most likely breakage would be if external code extended one of these classes and overrode clone() with a method returning a supertype (such as Object). That would lead to a compile-time error due to incompatible return types.

@stephengold stephengold linked an issue Nov 25, 2021 that may be closed by this pull request
@stephengold stephengold added this to the v3.5.0 milestone Nov 25, 2021
@pspeed42
Copy link
Contributor

Any code calling these clone() methods directly will now also throw an error if not recompiled.

I think it's a low risk change but it could mean if there are common libraries out there that call these clone methods directly that they would need to be recompiled or they will break applications that try to upgrade. (If so then those libraries are maybe doing things wrong and I'm kind of ok with forcing that conversation.) But worth noting just the same.

@stephengold
Copy link
Member Author

Worth mentioning in the release notes, assuming this gets integrated.

@stephengold
Copy link
Member Author

Unless there's further discussion, I plan to integrate this in about 24 hours.

@pspeed42
Copy link
Contributor

pspeed42 commented Dec 1, 2021

You are doing the lord's work, so to speak.

@stephengold
Copy link
Member Author

I hope I don't get crucified for it!

@stephengold stephengold merged commit 64e38a0 into master Dec 2, 2021
@stephengold stephengold deleted the sgold/clone-type branch December 2, 2021 20:48
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

Successfully merging this pull request may close these issues.

clone() methods returning a supertype

3 participants