We might be able to detect package tangles using https://www.archunit.org/
Comment From: philwebb
Here's how JUnit 5 currently use it https://github.com/junit-team/junit5/blob/b83b5f9ac58151a99ed88473cc15b3fdfc1c03b6/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java#L40-L43