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

added beImmutable() to ArchConditions #86

Merged
merged 2 commits into from
Jul 1, 2018
Merged

added beImmutable() to ArchConditions #86

merged 2 commits into from
Jul 1, 2018

Conversation

bgalek
Copy link
Contributor

@bgalek bgalek commented Jul 1, 2018

Hello, I've made new assertion to check if class is immutable (no mutable fields).
For me it would be useful. If You like it, please review my PR, I'm happy to update it if needed ;)

Feature wasn't discussed before so don't hesitate to decline the PR - I won't mind.

It was fun making a contribution to this project, keep up the good work!
I hereby agree to the terms of the ArchUnit Contributor License Agreement.

@hankem
Copy link
Member

hankem commented Jul 1, 2018

Nice! But I'd probably change the wording from beImmutable to, e.g., haveOnlyFinalFields (as a field can be final, but still be internally mutated).

@bgalek
Copy link
Contributor Author

bgalek commented Jul 1, 2018

name changed according to your comment ;)

@codecholeric
Copy link
Collaborator

Thanks for your PR!! I agree with @hankem, "immutable" would have been misleading, since a class can still heavily mutate its state (e.g. final List<Object> list = new ArrayList<>()).
But with the new rewording I like the addition, so I'll happily merge it 😃

@codecholeric codecholeric merged commit 2c6d949 into TNG:master Jul 1, 2018
codecholeric added a commit that referenced this pull request Jul 1, 2018
…oring.

Issue: #86
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
@codecholeric codecholeric added this to the 0.9.0 milestone Aug 19, 2018
@stefluhh
Copy link

stefluhh commented Aug 20, 2018

I love this one @bgalek . Comes in very handy especially for enforcement of immutability for ValueObjects in terms of Domain Driven Design. Thanks

@bgalek
Copy link
Contributor Author

bgalek commented Aug 20, 2018

@SteluHH I'm glad that my contribution is appreciated! 😎 Keep up the good work :)

codecholeric added a commit that referenced this pull request Feb 21, 2021
added haveOnlyFinalFields() to ArchConditions
codecholeric added a commit that referenced this pull request Feb 21, 2021
…oring.

Issue: #86
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
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.

4 participants