You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, this is correct, the current version cannot detect this, since ArchUnit only sees a raw reference to java.util.List. As soon as #115 is done, dependencies of a JavaClass can be extended with type parameters and this violation will then be detected.
As last step to fully support Generics within ArchUnit this adds support for generic method/constructor parameter types. In particular
* `JavaMethod.getParameterTypes()` now returns a `List` of `JavaParameterizedType` for parameterized generic method/constructor parameter types and the raw types otherwise
* all type arguments of generic method parameter types are added to `JavaClass.directDependencies{From/To}Self`
Example: ArchUnit would now detect `String` and `File` as `Dependency` of a method declaration like
```
class SomeClass {
void someMethod(Set<List<? super String>> first, Map<?, ? extends File> second) {
}
}
```
Note that analogously to the Java Reflection API `JavaConstructor.getParameterTypes()` and `JavaConstructor.getRawParameterTypes()` do not behave exactly the same for inner classes. While `JavaConstructor.getRawParameterTypes()` contains the enclosing class as first parameter type, `JavaConstructor.getParameterTypes()` does not contain it if the constructor has generic parameters. On the other hand it just returns the same list of raw parameter types if the constructor is non-generic. This might surprise some users, but I decided to stick to the same behavior as the Reflection API, because this has always been the strategy and the solution can never truly satisfy all assumptions a user might have.
Resolves: #115Resolves: #144Resolves: #440
Given:
Expected:
Actual:
Test:
The text was updated successfully, but these errors were encountered: