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

Avoid NotSerializableException when TryValues or EitherValues raise assertion failure #1884

Merged
merged 5 commits into from
Sep 25, 2020

Conversation

seblm
Copy link
Contributor

@seblm seblm commented Aug 30, 2020

Fixes #1883

@cla-bot
Copy link

cla-bot bot commented Aug 30, 2020

Hi @seblm, we require contributors to sign our Contributor License Agreement, and we don't have yours on file. In order for us to review and merge your code, please access https://www.artima.com/cla/choose-type to sign our Contributor License Agreement. Your effort is highly appreciated. Thank you.

@artimasites
Copy link

@cla-bot[bot] check

@cla-bot cla-bot bot added the cla-signed label Aug 30, 2020
@cla-bot
Copy link

cla-bot bot commented Aug 30, 2020

The cla-bot has been summoned, and re-checked this pull request!

@kpbochenek
Copy link

@seblm if you add custom serialization shouldn't you also add custom deserializer? Won't there be problems on side receiving this event?

Moving PatienceConfiguration to not be inner class would be too big change right?

@seblm
Copy link
Contributor Author

seblm commented Sep 10, 2020

@seblm if you add custom serialization shouldn't you also add custom deserializer? Won't there be problems on side receiving this event?

You've right: serializing then deserializing produce an error. I'll fix it.

Moving PatienceConfiguration to not be inner class would be too big change right?

Unfortunately, this change will not be binary compatible. I think it should be introduced in a major or a minor version instead of patch version.

@seblm
Copy link
Contributor Author

seblm commented Sep 10, 2020

@seblm if you add custom serialization shouldn't you also add custom deserializer? Won't there be problems on side receiving this event?

You've right: serializing then deserializing produce an error. I'll fix it.

With a proxy which is not an inner class, serialization of PatienceConfig is ok. @kpbochenek you can have a look.

@kpbochenek
Copy link

@seblm if you add custom serialization shouldn't you also add custom deserializer? Won't there be problems on side receiving this event?

You've right: serializing then deserializing produce an error. I'll fix it.

With a proxy which is not an inner class, serialization of PatienceConfig is ok. @kpbochenek you can have a look.

I don't know much about java serialization, as long as it works 👍

Just hope it can be merged and released quickly 🙏

@cheeseng
Copy link
Contributor

@seblm @kpbochenek Sorry for the late response, has been away for other works. I am looking into this now.

@cheeseng
Copy link
Contributor

@seblm @kpbochenek This PR unfortunately is having problem under scala-js and dotty build, I have submitted the following PR to your clone:

https://github.com/seblm/scalatest/pull/1

Can you sanity check if the fix works for you?

Note that I have run MIMA test for this PR + New PR, seems to pass. Hopefully we can release a new release containing this fix soon.

@kpbochenek
Copy link

Thanks for looking into it!
I will try to find a time and try it but it might not be that easy, tests show problem very well so if they pass I think that should be enough 👍

@seblm
Copy link
Contributor Author

seblm commented Sep 22, 2020

Thanks a lot @cheeseng for your pull request. It is now rebased onto my fork.
I was not aware of scala-js and dotty exceptions.

@cheeseng
Copy link
Contributor

@bvenners This PR looks good to me now, and it passed MIMA test, do you mind to review for merging when it is convenient for you? Do you mind if we release 3.2.3 and 3.1.5 for this?

Cheers.


/**
* Returns a <code>PatienceConfig</code> value providing default configuration values if implemented and made implicit in subtraits.
*/
def patienceConfig: PatienceConfig
}

protected[concurrent] object AbstractPatienceConfiguration extends AbstractPatienceConfiguration {
override def patienceConfig: PatienceConfig = PatienceConfig()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this protected[concurrent] instead of just private[concurrent]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've right: this visibility can be reduced to private. The change is applied.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tnx. Testing this now.

@bvenners bvenners merged commit f1a2b42 into scalatest:3.2.x-new Sep 25, 2020
@bvenners
Copy link
Contributor

Merged. Thanks very much for this PR!

@seblm
Copy link
Contributor Author

seblm commented Sep 25, 2020

Thank you to have merge it so quickly.

Do you think that it could be possible to drop jdk object serialization usage from scalatest?

@bvenners
Copy link
Contributor

@seblm Say you added SerialVersionUID annotations to two classes in this PR. Can you elaborate on why you thought that was important? I would think we may not want to give those, so they'll be generated from the class interface. Otherwise I think we have to pay attention to when we change it incompatibly, which we would likely miss. Tnx.

@seblm
Copy link
Contributor Author

seblm commented Oct 15, 2020

@bvenners you have right on this: I added SerialVersionUID more by habit than by real conviction. It is ok to remove these annotations for the sake of maintainability.

@seblm
Copy link
Contributor Author

seblm commented Jan 26, 2022

I am glad to see that #2086 will handle this problem more deeply 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reporter completed abruptly with TryValues
5 participants