Skip to content

Add ArchUnit test to prevent exposing Eclipse Collections iml types - #29

Open
mattbertolini wants to merge 2 commits into
assertj:mainfrom
mattbertolini:mbertolini/archunit-public-types-exposure-test
Open

Add ArchUnit test to prevent exposing Eclipse Collections iml types#29
mattbertolini wants to merge 2 commits into
assertj:mainfrom
mattbertolini:mbertolini/archunit-public-types-exposure-test

Conversation

@mattbertolini

Copy link
Copy Markdown
Collaborator

One of the rules I have when writing this library is that no types found in the org.eclipse.collections.impl.* packages should ever be used in the public API contract. This is because I only want to depend on their defined api interfaces. It's ok to use them internally to a method or in private methods, but I don't want to expose them to the public contract. This sounded like a good use case for ArchUnit.

I wrote a custom ArchCondition that checks the public API contract (public/protected constructor args, public/protected method args and return types, public/protected fields, parent classes, and interface types) for usages of forbidden packages. In my case its only one package right now.

This gives me a check to make sure I don't accidentally leak some types I don't want in the public contract while still giving me the opportunity to use them internally in method bodies and private methods.

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.

1 participant