github TNG/ArchUnit v0.5.0
ArchUnit 0.5.0

latest releases: v1.1.1, v1.2.2, v1.3.0...
6 years ago

Minor Breaking Changes

There were two minor things that were changed in an incompatible way (the migration should literally only take 1 minute, otherwise this ugliness would have had to be dragged on for a long time):

  • @AnalyzeClasses(importOption = ) is now a varargs @AnalyzeClasses(importOptions = ) that accepts a variable number of import options (a simple rename of "importOption" to "importOptions" should fix this). Changed in #2.
  • SimpleConditionEvent had a rather useless type parameter (since wherever it would be evaluated, the type would be '?' anyway, providing no further use), which was removed. This can be fixed, by performing a regex replace of "SimpleConditionEvent<[^>]*>" with "SimpleConditionEvent"

Apologies for any inconvenience this causes! This was mainly due to the fact, that the last release was the very first one and it should not happen again with the next release.

Bug Fixes

  • The ClassFileImporter now imports packages from JARs, even if the respective JAR entry is missing (it used to skip those, since classLoader.getResource(packagePathWithoutJarEntry) would return nothing; fixed in #11)
  • The ArchUnitRunner didn't evaluate @ArchIgnore on rule sets (i.e. fields of type ArchRules used to include other rules; fixed in #29)

Enhancements

There were enhancements in different areas:

Core

  • JavaClass has now a method JavaClass#isEnum (added in #5; many thanks to @storozhukBM )
  • The ClassFileImporter can now import multiple JARs at once (added in #8) and multiple paths at once (added in #10)
  • The ClassFileImporter is now more resilient, if a single class file is corrupt (before the whole import would fail, if a broken class file was encountered; added in #9)

Lang

  • should().onlyAccessedBy() now ignores self accesses (changed in #3)
  • Failing rules now report the number of violations in the error message (added in #24; many thanks to @hankem)
  • classes syntax now allows to filter and assert implementing interfaces (i.e. select classes that implement an interface or assert that certain classes should implement an interface; added in #36; many thanks to @hajotka)
  • classes syntax now allows to filter and assert startsWith/endsWith/contains on simple class names (added in #40 and #43; many thanks to @SteluHH)
  • layeredArchitecture() now allowes to ignore certain dependencies programmatically (added in #42)
  • slice rules (slices()...should().beFreeOfCycles() and slices()...should().notDependOnEachOther()) now allow to ignore certain dependencies programmatically (added in #46)

JUnit

  • @AnalyzeClasses now allows to specify custom LocationProviders, which can return any set of Locations (added in #37).
  • The cache used by ArchUnitRunner now uses soft references, thus the garbage collector should free the heap of imported classes, if the heap runs low, while keeping the classes cached by URL as long as there is enough heap (changed in #45)

Experimental Features

The following features are marked with @PublicAPI(state = EXPERIMENTAL) which means, that any method / class may change in any release at will. Use only at your own risk.

  • Added a new API to programmatically handle violations (i.e. react to the ConditionEvents and their corresponding objects, like JavaAccess; added in #16)
  • Added a new API to register custom extensions to react to violated rules. The idea is, to perform some custom reporting or visualization, but as long as there is no released part of ArchUnit that uses this API, it will remain experimental (added in #18)

Don't miss a new ArchUnit release

NewReleases is sending notifications on new releases.