All Versions
14
Latest Version
Avg Release Cycle
52 days
Latest Release
1432 days ago

Changelog History
Page 1

  • v0.14.1 Changes

    May 23, 2020

    ๐Ÿ› Bug Fixes

    • ๐Ÿ›  Fix broken Gradle metadata: Migrating the legacy Maven Plugin to the Publish Plugin caused some broken Gradle metadata published to Maven Central by accident. While 0.14.0 should work fine with any other build tool like Maven, Gradle will complain about a missing artifact archunit-junit, which does in fact not exist. This release fixes this by removing the broken metadata.
  • v0.14.0 Changes

    May 23, 2020

    ๐Ÿ’ฅ Breaking Changes

    • โฌ†๏ธ All methods that have been deprecated up to ArchUnit 0.12.0 have been removed. It might make sense to look through your code for usage of deprecated methods and follow the advice in the Javadoc before upgrading (see #329; thanks a lot to @rweisleder for removing the old deprecations)

    ๐Ÿ› Bug Fixes

    • ๐Ÿ›  Fix for Android where some classes were not imported correctly when run from the command line (see #319; also thanks a lot to @rweisleder for fixing the subsequent URI problems on Windows)
    • ๐Ÿ›  Fixed surprising behavior when using only{Call/Access}...That()... where the target of the call could not be resolved from the imported classes (see #340)

    โœจ Enhancements

    Core

    • ๐Ÿ‘€ JavaPackage now offers methods to retrieve the annotations of the respective package-info (see #263; thanks a lot to @rweisleder)
    • ๐Ÿ‘€ ClassFileImporter.importClasspath() now respects any ImportOptions passed via withImportOption(..) (see #296; thanks a lot to @rweisleder)
    • ๐Ÿ‘€ JavaMethod and JavaConstructor now have a heuristic line number instead of constant 0 (see #344; thanks a lot to @hankem)

    Library

    • ๐Ÿ‘€ The algorithm to detect cycles between slices has been improved from BFS to Johnson/Tarjan (see #138; thanks a lot to @torfmaster)
    • Cycle detection now has a configurable limit for the max number of cycles to detect (by default 100) and a max number of violations reported (by default 20 dependencies per edge). This can be reconfigured according to the user guide (see #326)
    • ๐Ÿ‘€ onionArchitecture() now supports to ignoreDependency(..) analogously to layeredArchitecture() (see #318; thanks a lot to @hankem)
    • ๐Ÿ‘€ There now is a rule to forbid field injection in favor of constructor injection (see #288; thanks a lot to @rweisleder)
    • ๐Ÿ‘€ There now is a rule to forbid dependencies on upper packages (see #151; thanks a lot to @qoomon for the initiative and POC)

    JUnit

    Further Acknowledgement

    • โฌ†๏ธ Thanks a lot to @aaschmid for extensive work to upgrade Gradle to the current version and to @jangalinski for the original initiative and draft (see #192, #284, #306 and #345)
  • v0.13.1 Changes

    February 04, 2020

    ๐Ÿ› Bug Fixes

    • ๐Ÿ›  Fixed java.lang.IllegalStateException: Couldn't find module modules of URI jrt:/... being thrown when trying to import JDK classes where JDK version >= 13. The path handling of JrtFileSystemProvider has been fixed according to JEP-220 with JDK 13. Unfortunately ArchUnit was dependent on the old behavior. (see #303)
  • v0.13.0 Changes

    January 10, 2020

    ๐Ÿ’ฅ Breaking Changes

    • ๐Ÿ‘€ While technically a very slim chance of really "breaking" anything, the log level of some details during the class file import has been reduced from DEBUG to TRACE (field, method, access and call details, ...) (see #291)

    โœจ Enhancements

    Core

    • ๐Ÿ‘€ Annotations and annotation parameters are now detected as dependencies. This could cause new findings when using the rules or library API. In particular JavaClass.getDirectDependencies{From/To}Self() will now also return Dependencies that originate from @FormerlyNotDetected or @Foo(someEnum = SomeEnumFormerlyNotDetected.FOO) or @Foo(bar = @Bar(type = SomeTypeFormerlyNotDetected.class)) (see #136; thanks a lot to @kosani)

    Lang

    • ๐Ÿ‘€ Some rule API method parameter types were invariant instead of contravariant (effectively preventing a predicate for a super type to be passed). These methods should now be fixed (see #262)
    • ๐Ÿ‘€ The rules API now offers more methods to filter and assert the type of class declaration ("top level class", "nested class", "member class", "inner class", "anonymous class" and "local class") (see #207; many thanks to @rweisleder)

    Library

    • ๐Ÿ‘€ FreezingArchRule by default now not only ignores line numbers, but also numbers after $ which effectively makes the ViolationStore resilient against changes in compiled lambda and anonymous class names (see #248; thanks a lot to @hankem)
    • ๐Ÿ‘€ LayeredArchitecture and OnionArchitecture now allow to configure optionalLayers(). In version 0.12.0 the behavior was made more strict, forbidding empty layers / parts of LayeredArchitecture and OnionArchitecture to prevent misconfiguration. This in turn unfortunately broke some valid use cases where empty / optional layers were in fact okay. In version 0.13.0 this is now completely configurable. By default it will still fail to prevent misconfiguration, but a switch of withOptionalLayers(true) or optionalLayer("Some Layer") will allow empty layers (and in turn empty parts of OnionArchitecture) (see #267 and #271; many thanks to @hankem)

    JUnit

    • there is now a ArchUnit JUnit 5 aggregator POM, i.e. instead of two dependencies archunit-junit5-api and archunit-junit5-engine, it is now also possible to simply add a single dependency archunit-junit5 with scope test / testCompile. Compare the user guide (see #272; thanks a lot to @eddumelendez)
    • โฌ†๏ธ Dependency upgrades (see #292)
      • junit-platform-* from 1.5.1 to 1.5.2
      • junit4 from 4.12 to 4.13 (in case of problems with archunit-junit4 it should be possible to exclude the transitive dependency to JUnit 4.13 and replace it by a custom 4.12 one)

    Further Acknowledgement

    • Many thanks to @Bananeweizen for fixing spelling and grammar mistakes in Javadoc / methods
  • v0.12.0 Changes

    November 03, 2019

    ๐Ÿ’ฅ Breaking Changes

    • ๐Ÿ‘€ So far ArchUnit's terminology has been a little sloppy with respect to the naming of inner and nested classes. By the JLS "inner classes" are those classes that are nested and not static. ArchUnit's API now reflects this via JavaClass.isNestedClass() versus JavaClass.isInnerClass(). Unfortunately this means that the method formerly called JavaClass.isInnerClass() will now return a different result, i.e. it will only return true, if the class is non-static. On the other hand, the method JavaClass.isNestedClass() will behave exactly like isInnerClass() did in ArchUnit 0.11.0 (see #224; thanks a lot to @rweisleder for the clarification and PR)
    • ๐Ÿ‘€ JavaAccessCondition does not filter self-accesses anymore. This was confusing behavior that did not solve the issue it was originally intended for. However, this might lead to additional violations showing up (see #209)

    ๐Ÿ› Bug Fixes

    • ๐Ÿ›  Fixed bug where simple name of local classes was incorrect (see #216; thanks a lot to @rweisleder)
    • ๐Ÿ‘€ static modifier was missing from nested classes (see #219; thanks a lot to @rweisleder)

    โœจ Enhancements

    Core

    • ๐Ÿ‘Œ Support for Java 14 (see #230; thanks a lot to @hankem)
    • ๐Ÿ‘€ JavaModifier now contains SYNTHETIC and BRIDGE allowing more introspection and filtering of synthetic members (see #243; thanks a lot to @alexfedorenchik)
    • Every property in archunit.properties can now be overwritten by passing a system property. This can be valuable in CI environments, e.g. to specify the ViolationStore path for FreezingArchRule. Compare the user guide (see #252)
    • ๐Ÿ‘€ A JavaClass representing an array can now be queried for its component type (see #187; thanks a lot to @alexfedorenchik)
    • ๐Ÿ‘€ JavaClass now offers a classpath independent version of getMethod(..) and getConstructor(..) (see #236; thanks a lot to @rweisleder)

    Lang

    • ๐Ÿ‘€ Extended syntax for classes().thatAreEnums() and classes()...should().beEnums() (see #172; thanks a lot to @rweisleder)

    Library

    • ๐Ÿ‘€ LayeredArchitecture now also checks that no layer is empty. While originally with good intentions, the ability to define empty layers turned out to do more harm than good (see #177; thanks a lot to @mikomatic)
    • ๐Ÿ‘€ LayeredArchitecture now allows layers to be defined by predicate. This allows for a way more flexible definition than simple package patterns (see #228; thanks a lot to @mikomatic)
    • FreezingArchRule can now be configured to be more strict, when checking rules. In particular it is possible to forbid updates of the ViolationStore or the creation of a new ViolationStore. This can serve as a safeguard in CI environments, where a missing ViolationStore is typically a misconfiguration. Compare the user guide (see #211; thanks a lot to @hankem for reviewing and providing valuable improvements)
  • v0.11.0 Changes

    July 30, 2019

    โœจ Enhancements

    Core

    • ๐Ÿ‘€ DescribedPredicate now offers a more lambda compatible factory method DescribedPredicate.describe(description, predicate) (see #188; thanks a lot to @jzheaux)
    • ๐Ÿ†• New factory method DescribedPredicate.allElements(..) to complement DescribedPredicate.anyElementThat(..) (see b8890f4)
    • ๐Ÿ‘Œ Support for JDK 13 (see #195; thanks a lot to @jqno)
    • ArchUnits configuration (archunit.properties) and ignore patterns (archunit_ignore_patterns.txt) are now loaded with the ContextClassLoader instead of the ClassLoader of the respective class (see 81c31f6)

    Lang

    • New method classes().that().belongToAnyOf(..) to match any class or inner class of the passed classes (see #173; thanks a lot to @moboa)
    • ๐Ÿ†• New method classes().should().haveOnlyPrivateConstructors() (see #204; thanks a lot to @sullis)
    • ๐Ÿ†• New methods members().should().{have,notHave}FullName[Not][Matching](..) (see #205; thanks a lot to @hankem)

    Library

    • ๐Ÿ†• New FreezingArchRule to wrap any other ArchRule and change the behavior (see #181):
      • on the first run record all existing violations
      • on further runs only fail by unknown violations
      • also on further runs automatically decrease the stored violation count if existing violations are solved
      • compare the user guide
    • New Architectures.onionArchitecture() API offering a predefined API for Onion or Hexagonal Architectures, compare the user guide (see #174; thanks a lot to @spanierm)

    JUnit

    • โฌ†๏ธ The JUnit 5 platform dependency has been upgraded to version 1.5.1

    Further Acknowledgement

    • Thanks a lot to @hankem for adjusting Spotbugs to ignore false positives with JDK 9
    • โœ… Thanks a lot to @hankem for fixing incompatibilities of some tests with JDK 12
    • ๐ŸŒฒ Thanks a lot to @vincent-fuchs for improving ArchUnit's logging
    • โฌ†๏ธ Thanks a lot to @sullis for upgrading dependencies
  • v0.10.2 Changes

    March 31, 2019

    ๐Ÿ› Bug Fixes

    • ๐Ÿ›  Fixed JavaPackage.getPackageDependenciesFromSelf() containing the package itself if there was a dependency in the same package but not directly imported (e.g. importer.importClasses(Foo.class) where some.pkg.Foo would depend on some.pkg.Bar, which was not imported)

    โœจ Enhancements

    Core

    • Some methods now return Collection types instead of Iterable to integrate nicer with streams

    Lang

    • ๐Ÿ‘€ FieldsShould now contains the negation notHaveRawTypes (see #162; thanks a lot to @asbachb)
    • CodeUnitsShould now contains the negations notHaveRawParameterTypes, notHaveRawReturnType and notDeclareThrowableOfType
    • ๐Ÿ‘€ The syntax now contains {methods,fields}().should().{be,notBe}{Static,Final} (see #164; thanks a lot to @hankem)

    Library

    • Slice now also offers dependenciesToSelf additionally to dependenciesFromSelf

    Further Acknowledgement

    • Thanks a lot to @hankem for reviewing and improving the user guide
  • v0.10.1 Changes

    March 17, 2019

    ๐Ÿ› Bug Fixes

    • ๐Ÿ“ฆ JavaPackage.PackageVisitor and JavaPackage.ClassVisitor are now public instead of package-private to be usable as public API
  • v0.10.0 Changes

    March 17, 2019

    ๐Ÿ’ฅ Breaking Changes

    • ๐Ÿ“ฆ The deprecated method String JavaClass.getPackage() was replaced by JavaPackage JavaClass.getPackage(). To query the package name, please use String JavaClass.getPackageName().
    • ๐Ÿšš The deprecated method JavaClass.getDirectDependencies() has been removed -> use JavaClass.getDirectDependenciesFromSelf() instead
    • ๐Ÿšš The deprecated field JavaClass.Functions.SIMPLE_NAME has been removed, please use JavaClass.Functions.GET_SIMPLE_NAME

    ๐Ÿ†• New Deprecation

    • ๐Ÿ‘€ ArchUnit does not use contractions anymore within the rules API. So far many methods were phrased like dontHave...() instead of doNotHave...(). In general this seems to be more trouble than worth it and does not read that well without an apostrophe, so all those methods were declared deprecated and have a new counter part without the contraction. A simple search & replace of dont by doNot should fix all those deprecations.
    • ๐Ÿ—„ Some methods were deprecated because they were not precise enough, if generics come into play. For example JavaClass JavaField.getType() is not precise enough, because the type of a field is something else than a JavaClass (like T someField or List<? extends T> someField). Thus all those methods have been deprecated to make room for a future extension with generics and instead got a new version explicitly stating that the "raw type" is meant. For example JavaField.getType() -> JavaField.getRawType(), JavaMethod.getParameters() -> JavaMethod.getRawParameterTypes().
    • ๐Ÿ—„ Formatters.formatLocation(JavaClass, lineNumber) was deprecated in favor of the newly introduced SourceCodeLocation.of(JavaClass, lineNumber) which will report the correct location (i.e. link for IDEs) via toString()

    โœจ Enhancements

    Core

    • The default class resolution behavior for classes missing from the import was changed. Before by default missing classes were replaced by stubs, now by default they will be resolved from the classpath. Compare the user guide (see #111)
    • ๐Ÿ‘€ JavaClass can now be queried for declared throws clauses, any Throwables declared on methods or constructors count as dependencies of a JavaClass (see #126; thanks a lot to @tngwoerleij)
    • ๐Ÿ‘€ JavaClass can now be queried if it is an array (see #114; thanks a lot to @wengertj)
    • The resolution of classes from the classpath will now use the context ClassLoader if set (should usually not make any difference, but allows to control the ClassLoader used by ArchUnit for class resolution)
    • ๐Ÿ‘€ JavaClass now has a more sophisticated JavaPackage attached to it. It is also possible to retrieve any JavaPackage from JavaClasses. JavaPackage offers a more convenient API for dependencies between packages (see #158; thanks a lot to @goetzd for reviewing and user guide adjustment)
    • ๐Ÿ‘€ For arrays JavaClass.getPackageName() now returns the package of the component type instead of empty. While empty is closer to the Java Reflection API, it is not really useful from a point of view of dependencies. Using an array of a type in a package should cause a dependency to that package (see #161)

    Lang

    • ๐Ÿ‘€ The rules API now provides an extensive support for checks of members / methods / fields (see #38; thanks a lot to @hankem for an extensive review and many improvements)

    Library

    • ๐Ÿ‘€ It is now possible to create a CompositeArchRule from several ArchRules to check multiple rules at once (see #78; thanks a lot to @bogsi17)
    • The PlantUML rules API now understands more types of arrows (description on arrows, arrows from right to left, arrow colors), compare the user guide (see #135)
    • ๐Ÿ†• New predefined rule to avoid the use of org.joda.time in favor of the java.time API (see #145; thanks a lot to @sullis)
    • The slices API is now more configurable to deal with inconsistent package structures and legacy projects. It is now possible to customize the assignment of JavaClasses to Slices by a simple function JavaClass -> Identifier, compare the user guide (see #156)

    JUnit

    • โฌ†๏ธ The JUnit 5 platform dependency has been upgraded to version 1.4.0.

    Further Acknowledgement

    • ๐Ÿ— Thanks a lot to @alanktwong for improving the CONTRIBUTING docs on how to build the project
    • ๐Ÿ—„ Thanks a lot to @wengertj for removing use of deprecated Gradle API
    • ๐Ÿ— Thanks a lot to @olleolleolle for replacing the PNG build badge by SVG
    • โšก๏ธ Thanks a lot to @sullis for updating the Travis build to use OpenJDK 11
  • v0.9.3 Changes

    November 20, 2018

    ๐Ÿ› Bug Fixes

    ๐Ÿ›  Fixed memory leak in combination of the newly added ArchRule.AssertionError and JUnit 4. JUnit 4 keeps references to all thrown AssertionErrors through the whole run. Since ArchRule.AssertionError kept a reference to EvaluationResult this could consume a lot of memory, if the respective results were big.
    ๐Ÿš€ This release removes ArchRule.AssertionError (introduced in version 0.9.0).

    ๐Ÿ’ฅ Note that this is in theory a breaking change , since it would have been possible to catch and process ArchRule.AssertionError. There does not seem to be any clean solution to this problem though, and due to the slim probability that the removal of this part of the API will in fact affect any user, the step seems justified.

    ๐Ÿ†“ If anybody should against all odds have a problem with this, feel free to open an issue and we will find a different solution.

    โœ… Also ArchUnitTestEngine's engine id has been adjusted from junit-archunit to archunit to get rid of the warning JUnit 5 emits since version 1.3.0.