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

QuarkusTestExtension#runExtensionMethod() should only deep clone when necessary #10152

Open
knutwannheden opened this issue Jun 22, 2020 · 6 comments
Labels
kind/enhancement New feature or request

Comments

@knutwannheden
Copy link
Contributor

Description
QuarkusTestExtension#runExtensionMethod() appears to do a deep-clone of all arguments of a given test method. If the parameter class is the same in both class loaders (i.e. both loaded it through a common ancestor class loader) this wouldn't be necessary and avoiding the deep-clone would also be desirable because not all objects can be cloned (see #9677).

@knutwannheden knutwannheden added the kind/enhancement New feature or request label Jun 22, 2020
@geoand
Copy link
Contributor

geoand commented Jun 22, 2020

Unfortunately it's not that simple. If for example you have a Supplier that supplies an object that was created from the System classloader, you still need to clone the supplied object into the TCCL.

Now all this stuff is definitely nasty, I don't see any good solution to the problem.

@knutwannheden
Copy link
Contributor Author

Yes, of course one of the deeply referenced objects may need cloning. So the cloning algorithm would then first have to check if any of the objects in the graph needs cloning or not, which isn't very nice either...

@knutwannheden
Copy link
Contributor Author

Possibly it would help the JUnit team if the Quarkus use case could be explained in detail in the context of junit-team/junit5#201.

@geoand
Copy link
Contributor

geoand commented Jun 22, 2020

@stuartwdouglas has already chatted with the JUnit team about this, so they are aware of our case

@knutwannheden
Copy link
Contributor Author

Unless you will consider implementing a more clever deep cloning algorithm (only cloning if at least one object in the graph needs cloning), I think we can close this issue again. Hopefully the JUnit 5 issue will be addressed in the not too distant future...

@geoand
Copy link
Contributor

geoand commented Jun 22, 2020

Hopefully we won't have to create a more clever cloning algorithm, but it may come to that at some point...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants