|
8 | 8 | import com.tngtech.archunit.lang.ConditionEvents; |
9 | 9 | import com.tngtech.archunit.lang.SimpleConditionEvent; |
10 | 10 | import lombok.extern.slf4j.Slf4j; |
11 | | -import org.jspecify.annotations.NonNull; |
12 | 11 | import org.jspecify.annotations.NullMarked; |
13 | 12 |
|
14 | 13 | import java.util.HashMap; |
@@ -49,14 +48,14 @@ public void check(JavaClass javaClass, ConditionEvents events) { |
49 | 48 | validateSortMappings(javaClass, events, mappings); |
50 | 49 | } |
51 | 50 |
|
52 | | - private static @NonNull DetectedSortField detectSortMappings(JavaClass javaClass) { |
| 51 | + private static DetectedSortField detectSortMappings(JavaClass javaClass) { |
53 | 52 | // Read SortMappings static fields, resolve their enum type, and collect key names |
54 | 53 | var fieldToKeyNames = new HashMap<String, Set<String>>(); |
55 | 54 | var fieldToEnumClassName = new HashMap<String, String>(); |
56 | 55 | try { |
57 | 56 | var runtimeClass = Class.forName(javaClass.getFullName()); |
58 | 57 | for (var field : javaClass.getFields()) { |
59 | | - if (field.getRawType().getFullName().equals( |
| 58 | + if (field.getRawType().isAssignableTo( |
60 | 59 | "it.aboutbits.springboot.toolbox.persistence.SortMappings")) { |
61 | 60 | String enumClassName = null; |
62 | 61 |
|
@@ -157,8 +156,7 @@ private static void validateSortMappings( |
157 | 156 | var fieldLine = javaClass.getFields().stream() |
158 | 157 | .filter(f -> f.getName().equals(fieldName)) |
159 | 158 | .filter(f -> f.getRawType() |
160 | | - .getFullName() |
161 | | - .equals("it.aboutbits.springboot.toolbox.persistence.SortMappings")) |
| 159 | + .isAssignableTo("it.aboutbits.springboot.toolbox.persistence.SortMappings")) |
162 | 160 | .findFirst() |
163 | 161 | .map(f -> f.getSourceCodeLocation().getLineNumber()) |
164 | 162 | .orElse(-1); |
|
0 commit comments