Skip to content

Releases: TNG/ArchUnit

ArchUnit 1.1.1

25 Apr 14:01
Compare
Choose a tag to compare

Bug Fixes

  • Fix ArchUnit importer being unable to import classes from Spring Boot Nested jars (see #1224)

ArchUnit 1.2.2

23 Apr 22:46
Compare
Choose a tag to compare

Bug Fixes

  • Fix ArchUnit importer being unable to import classes from Spring Boot Nested jars (see #1224)

ArchUnit 1.3.0

11 Apr 14:47
Compare
Choose a tag to compare

Bug Fixes

  • Fix ArchUnit importer being unable to import classes from Spring Boot Nested jars (see #1224)
  • Fix OnionArchitecture losing withOptionalLayers() on description override (see #1185)
  • Fix JavaType.getAllInvolvedRawTypes() recursing infinitely for recursive type definitions (see #1237)
  • Fix @ArchTest fields in base classes of @ArchIgnored classes not being ignored (see #1277)

Enhancements

Core

  • Add support for Java 23 (see #1275; thanks a lot to @hankem)
  • New method JavaType.traverseSignature(..) to examine parts of a type signature more conveniently (see 8456198 of #1276)

Lang

  • Make handling specific violating object types with ViolationHandler more convenient (see #1251)

Library

  • Jakarta EE annotations are now considered in GeneralCodingRules.NO_CLASSES_SHOULD_USE_FIELD_INJECTION (see #1285; thanks a lot to @hankem)
  • PlantUML rules now ignore dependencies between unparsable objects (e.g. a database instead of a regular component) (see #1132; thanks a lot to @tfij)
  • PlantUML rules now optionally support the component keyword in component [Example] <<..example..>> (see #1223; thanks a lot to @tfij)

JUnit

  • @ArchTests included via ArchTests.in(..) now report their full "inclusion path" in the test report (see #452, #1279)
  • Specific @ArchTest rules can now be executed by setting the ArchUnit property junit.testFilter=rule_field_name / setting the system property -Darchunit.junit.testFilter=... (compare the user guide; see #1280)

Further Acknowledgement

  • Thanks a lot to @hankem for improving the user guide (see #1221)

ArchUnit 1.2.1

03 Dec 23:24
Compare
Choose a tag to compare

Bug Fixes

  • Fix crash on importing inner classes that use += string concatenation on outer class private field (see #1146, #1194)

ArchUnit 1.2.0

06 Nov 00:30
Compare
Choose a tag to compare

Enhancements

Core

  • Add support for Java 22 (see #1172; thanks a lot to @hankem)
  • New methods {JavaType/JavaMember}.getAllInvolvedRawTypes() to quickly detect all raw types contributing to a type (e.g. List<? extends Serializable>) or member (e.g. List<? extends Serializable> method(Set<String> args) {..}) (see #723; thanks a lot to @leonardhusmann)

Lang

  • New rules API FieldsShould.{be/notBe}AccessedByMethodsThat(predicate) to prevent fields from being accessed by certain methods (see #857; thanks a lot to @leonardhusmann)

Library

  • New extensive modules rule syntax to support easier checks for modularization (dependency direction, API surface, ...) (compare the user guide; see #1078)

JUnit

Further Acknowledgement

ArchUnit 1.1.0

09 Aug 14:55
Compare
Choose a tag to compare

Bug Fixes

  • Try-Catch-Blocks declared within lambdas will now be detected correctly (see #1069)
  • Fix ArchUnit not being able to find classes loaded by Spring Boot ClassLoader (see #1131; thanks a lot to @odrotbohm)

Enhancements

Core

  • New ImportOption DoNotIncludeGradleTestFixtures (see #949)
  • Reduce all log levels except WARN to TRACE (see #1050)
  • Add support for Java 21 (see #1098)

Library

  • Two new GeneralCodingRules (see #970; thanks a lot to @hankem)
    • ASSERTIONS_SHOULD_HAVE_DETAIL_MESSAGE
    • DEPRECATED_API_SHOULD_NOT_BE_USED
  • TextFileBasedViolationStore is now part of the public API and can thus be used for customization; as a special case of this file names can now be adjusted (see #1046; thanks a lot to @danhaywood)
  • TextFileBasedViolationStore now adds a final new line character to the violation file to better conform to the spec (see #1057; thanks a lot to @pkubowicz)

ArchUnit 1.0.1

21 Nov 18:21
Compare
Choose a tag to compare

Bug Fixes

  • Fix bug where referenced class objects and instanceof checks were not detected if declared within a lambda (see #992)
  • Fix empty records not being detected as records (see #998; thanks a lot to @hankem)
  • Fix Javadoc on layeredArchitecture() missing the new consideringDependencies part (see #977; thanks a lot to @Thunderforge)
  • Fix user guide still showing DescribedPredicate.apply instead of .test (see #978; thanks a lot to @thmuch)

ArchUnit 1.0.0

03 Oct 18:04
Compare
Choose a tag to compare

⚠️ If you upgrade from the latest 0.x version, please also refer to the release notes of release candidate 1.0.0-rc1 as these release notes refer to upgrading from the release candidate ⚠️

Breaking Changes

  • Naming around JavaPackage subpackages and dependencies has been improved to remove ambiguities. In general, whenever all classes from a package and subpackages recursively are involved, this is now called "package tree". Otherwise, it only targets the classes directly within this package (see #919/#968; thanks a lot to @grimsa)
    The following mapping shows how to translate the old methods to the current methods:
    • getAllClasses() -> getClassesInPackageTree()
    • getAllSubpackages() -> getSubpackagesInTree()
    • getClassDependenciesFromSelf() -> getClassDependenciesFromThisPackageTree()
    • getClassDependenciesToSelf() -> getClassDependenciesToThisPackageTree()
    • getPackageDependenciesFromSelf() -> getPackageDependenciesFromThisPackageTree()
    • getPackageDependenciesToSelf() -> getPackageDependenciesToThisPackageTree()
    • accept(..) -> traversePackageTree(..)
  • Importing the default package via ClassFileImporter.importPackages("") will now yields the same result as using importClasspath() without any ImportOption (see #954)
  • ClassFileImporter.importClasspath() now behaves consistently to other import APIs. I.e. no default ImportOptions like DoNotIncludeArchives are added anymore, instead all ImportOptions need to be added the same way as for all other import methods (see #958)
  • The custom collection ImportOptions has been removed from the public API and been replaced by a standard Collection<ImportOption> where appropriate (see #958)
  • The package com.tngtech.archunit.library.plantuml has been moved to com.tngtech.archunit.library.plantuml.rules to make room for adding other PlantUML related features (see #959)
  • SLF4J-API has been upgraded from 1.7.30 to 2.0.3, so any log adapter dependency to be used with ArchUnit (e.g. to hook in Log4J) has to be compatible with SLF4J-API 2.x from now on (see #966)

Bug Fixes

  • Fix bug where multiple synthetic access calls to methods like access$123(..) would lead to only one access being imported. Note, that these synthetic methods are added for calls to private fields / methods from inner classes to outer classes, etc. (see #957)

Enhancements

Lang

  • archunit_ignore_patterns.txt is now also respected by FreezingArchRule. Thus, ignored violations are not added to the ViolationStore anymore (see #915)

Library

  • testClassesShouldResideInTheSamePackageAsImplementation(..) now supports multiple test classes with same simple name (see #918; thanks a lot to @mslowiak)
  • PlantUmlArchCondition now does not throw exceptions anymore, if a class is in none or multiple components, but instead reports those as standard violations. This way these violations can also be frozen via FreezingArchRule instead of crashing the test (see #960)

Further Acknowledgement

  • Thanks a lot to @hankem for upgrading various dependencies, cleaning up code and extensive reviews

ArchUnit 1.0.0-rc1

13 Jul 18:11
Compare
Choose a tag to compare

Breaking Changes

  • All deprecated members and classes have been removed (see #909)
  • @AnalyzeClasses() without any explicit locations to import will now import the package of the annotated class by default instead of the whole classpath. To restore the old behavior use @AnalyzeClasses(wholeClasspath = true) (see #828)
  • The archunit-junit5-engine-api now resides within the package com.tngtech.archunit.junit.engine_api instead of directly under junit. This only affects users that want to programmatically interface with the ArchUnitTestEngine and should be irrelevant for most users (see #827)
  • ArchUnit now needs at least Java 8 to run (see #833)
  • The ArchUnit types Function, Predicate and Optional have been replaced by the JDK 8 equivalents
  • DescribedPredicate now extends the JDK 8 Predicate, so apply(..) has to be replaced by test(..)
  • layeredArchitecture() now forces to decide how to deal with dependencies by adding .considering...Dependencies() in the beginning of the declaration. To restore the old behavior declare it as layeredArchitecture().consideringAllDependencies() (see #892)
  • ConditionEvents is now an interface and the interface has been cleaned out of all non-essential methods, e.g. getAllowed(). This was done to increase maintainability and make it easier to optimize the internals. If you are missing any functionality now, please file an issue to discuss it (see #876)
  • PackageMatcher was moved from package base to core.domain (see #894)
  • Primitive classes now reside in package java.lang to be consistent with the Reflection API's Class.getPackageName() (see #905)
  • PlantUmlArchCondition.Configurations has been merged into PlantUmlArchCondition.Configuration (see #891)

Bug Fixes

  • While technically no real bug PlantUmlArchCondition.Configuration is now a public class instead of an interface, which solves a (non-fatal) Kotlin compiler warning complaining about the access rights (see #888)

Enhancements

Core

  • Accesses from inside of lambdas are now correctly detected. Before, the origin was set as a synthetic method like lambda$xxx$123 instead. JavaAccess can now be queried for isDeclaredInLambda() to distinguish this from an access outside of a lambda (see #847; thanks a lot to @oberprah, @FrederikFinckh)
  • Support for Java 19 (see #845)
  • It is now possible to analyze try-catch-blocks, e.g. if a method call is wrapped into a try-catch-block catching a certain exception type (see #591; thanks a lot to @crizzis)
  • Package identifiers like ..myapp.service.. now support alternations via ..[service|legacy_service]... This also works for capturing groups like (a|b). Note that alternation groups cannot be nested (see #662; thanks a lot to @Pfoerd)
  • DescribedPredicate now offers static factory methods and(predicates) and or(predicates) that join together varargs DescribedPredicate<>... or Iterable<DescribedPredicate<>> via AND or OR (see #805)
  • The importer now ignores synthetic $SwitchMap$ fields of enums (see #570)
  • Private member accesses are now correctly reported between inner classes. Before, the origin was set as a synthetic method access$123 (see #889)
  • ImportOption.DoNotIncludeTests now works for plain IntelliJ project layouts (see #696; thanks a lot to @JCook21)

Lang

  • New methods codeUnits().should().onlyBeCalled().by{Classes/Methods/...}That(..) (see #810; thanks a lot to @JKLedzion)
  • ArchCondition evaluation is now more efficient and has a smaller memory footprint (see #876)
  • The ArchCondition to search for transitive dependencies has been improved and now only reports relevant dependencies, in particular when checking for transitive dependencies between packages a and b (see #780; thanks a lot to @Pfoerd)
  • New APIs ArchCondition.from(predicate) and ArchConditions.{be/have}(predicate) to easily create ArchConditions from DescribedPredicates (see #855; thanks a lot to @u3r)
  • Javadoc of the rules API has been extended to better guide to predefined DescribedPredicates like JavaClass.Predicates or HasName.Predicates (see #912)
  • New convenience method ConditionEvent.createMessage(..) to easily create a standard ArchRule violation message like Class <..> some description in (...java:123) (see #826)

Library

  • layeredArchitecture() now allows to easily specify how to deal with dependencies from classes within the layers. E.g. should only dependencies that target other classes within the layers be considered? Or all dependencies in the root package of the application? This should solve common confusion about dependencies on classes like java.lang.Object being reported (see #887)
  • onionArchitecture() components can now not only be defined by package identifiers but also by predicates (see #894)
  • layeredArchitecture() and onionArchitecture() now support ensureAllClassesAreContainedInArchitecture() (see #278; thanks a lot to @roxspring)
  • New rule GeneralCodingRules.testClassesShouldResideInTheSamePackageAsImplementation() to check that test classes reside in the same package as their class under test (see #475; thanks a lot to @mslowiak)

JUnit

  • The archunit-junit5 can now be used on the modulepath as well as the classpath (see #206)
  • JUnit 5 discovery speed is now notably faster in test projects with a lot of dependencies (see #546)
  • For JUnit 5 support @ArchTest is now also supported within abstract base classes (see #104; thanks a lot to @hankem)

Further Acknowledgement

ArchUnit 0.23.1

27 Feb 15:34
Compare
Choose a tag to compare

Bug Fixes

  • Fix exception Never found a JavaCodeUnit that matches supposed origin... occurring with Kotlin inline functions where the descriptor of a method deviates from the signature (this was introduced by checking the return type of the method as well when looking for a call origin in #714; see #804, #807)
  • Fix optional layers of LayeredArchitecture failing with the new default behavior archRule.failOnEmptyShould = true (see #809; thanks a lot to @oberprah)

Enhancements

  • Log automatic resolution configuration on debug to reduce log clutter (see #802)
  • Add new Method ArchRule.allowEmptyShould(boolean) to override the configured archRule.failOnEmptyShould configuration on a per rule basis (see #803, #806, #808; thanks a lot to @oberprah)