File tree 1 file changed +9
-2
lines changed
buildSrc/src/main/java/org/springframework/build/architecture
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package org .springframework .build .architecture ;
18
18
19
+ import com .tngtech .archunit .base .DescribedPredicate ;
19
20
import com .tngtech .archunit .core .domain .JavaClass ;
20
21
import com .tngtech .archunit .lang .ArchRule ;
21
22
import com .tngtech .archunit .lang .syntax .ArchRuleDefinition ;
@@ -66,8 +67,14 @@ static ArchRule classesShouldNotImportForbiddenTypes() {
66
67
67
68
static ArchRule javaClassesShouldNotImportKotlinAnnotations () {
68
69
return ArchRuleDefinition .noClasses ()
69
- .that ().haveSimpleNameNotEndingWith ("Kt" )
70
- .and ().haveSimpleNameNotEndingWith ("Dsl" )
70
+ .that (new DescribedPredicate <JavaClass >("is not a Kotlin class" ) {
71
+ @ Override
72
+ public boolean test (JavaClass javaClass ) {
73
+ return javaClass .getSourceCodeLocation ()
74
+ .getSourceFileName ().endsWith (".java" );
75
+ }
76
+ }
77
+ )
71
78
.should ().dependOnClassesThat ()
72
79
.resideInAnyPackage ("org.jetbrains.annotations.." )
73
80
.allowEmptyShould (true );
You can’t perform that action at this time.
0 commit comments