-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for casts #710
Comments
Is this issue open? If yes I would like to try to work on it. |
@Kaammill and yes, the issue is up for grabs and we're always super happy about contributions 😃 |
Add support for casts TNG#710 Signed-off-by: Kaammill <>
Some information about The compiler might add some checkcast instructions:
What I noticed: if the previous instruction is |
Also bridge methods will have more compiler |
Detecting casts are also useful when working with polymorphism in hibernate, where instanceof and direct casts should not be used due to hibernate proxies. Having this feature in archunit would also help in building rules for this case |
Detect *checkcast* asm instructions as TypeCast (similar to InstanceofCheck) Implicit checkcast instructions generated by compiler due to method invocations are ignored Signed-off-by: Allan Jones <[email protected]>
Detect *checkcast* asm instructions as TypeCast (similar to InstanceofCheck) Implicit checkcast instructions generated by compiler due to method invocations are ignored Signed-off-by: Allan Jones <[email protected]>
Detect checkcast asm instructions as TypeCast (similar to InstanceofCheck) Implicit checkcast instructions generated by compiler due to method invocations are ignored Resolves TNG#710 Signed-off-by: Allan Jones <[email protected]>
Detect checkcast asm instructions as TypeCast (similar to InstanceofCheck) Implicit checkcast instructions generated by compiler due to method invocations are ignored Resolves TNG#710 Signed-off-by: Allan Jones <[email protected]>
Detect checkcast asm instructions as TypeCast (similar to InstanceofCheck) Implicit checkcast instructions generated by compiler due to method invocations are ignored Resolves TNG#710 Signed-off-by: Allan Jones <[email protected]>
At the moment casts without any further dependencies on the target type are not detected as dependencies. I.e.
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:
Set<TypeCast> JavaCodeUnit.getCasts()
(compareInstanceofCheck
)TypeCast
s toJavaClass.directDependencies{From/To}Self
(open for discussion: What is the best name for the domain object?
TypeCast
,Cast
,JavaCast
,ClassCast
, ...?)The text was updated successfully, but these errors were encountered: