-
Notifications
You must be signed in to change notification settings - Fork 326
Open
Description
At the moment casts without any further dependencies on the target type are not detected as dependencies. I.e.
SomeClass example(Object rawInput) {
return (SomeClassImpl) rawInput; // should forbid dependencies on SomeClassImpl
}
Since there are no further dependencies on SomeClassImpl this would be missed. It does likely not cause a maintenance problem later, because the cast could at any time be weakened to (SomeClass) without any further compile or runtime issues, but still it would be nice to detect these things. Also to be able to access all casts that a class or method applies could be useful for other scenarios.
We could add this the following way:
- extend
Set<TypeCast> JavaCodeUnit.getCasts()(compareInstanceofCheck) - add the
TypeCasts toJavaClass.directDependencies{From/To}Self
(open for discussion: What is the best name for the domain object? TypeCast, Cast, JavaCast, ClassCast, ...?)