-
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
Feature Request: Support for analysis of local variables #768
Comments
Technically this should be doable 🙂 But notice that there once already was #227 which pretty much suggested the same I think? However, I didn't get around to it back then and nobody else was willing to tackle it either, so I eventually closed it 😞 |
For more persons to find their way to this thread ... |
Hello, is there still nobody working on this issue? I am willing to do so. |
Ok, at least someone likes this ;) |
A simple solution for including local variables in the dependency checks is here: #1327 |
So far local variable instantiations were not analyzed at all, leaving gaps in the evaluation of dependency rules. If a local variable of a certain type was instantiated in a method, but no other use of that type was present (e.g. a method call on the type, or a field access), the dependency from the method to that type was undetected. Here, if enabled by a new configuration property (to preserve backward compatibility and performance), local variable instantiations add class dependencies from the surrounding method to the type of the variable and, if that type has generic type parameters, also from the method to any concrete generic type. Issue: TNG#768
So far local variable instantiations were not analyzed at all, leaving gaps in the evaluation of dependency rules. If a local variable of a certain type was instantiated in a method, but no other use of that type was present (e.g. a method call on the type, or a field access), the dependency from the method to that type was undetected. Here, if enabled by a new configuration property (to preserve backward compatibility and performance), local variable instantiations add class dependencies from the surrounding method to the type of the variable and, if that type has generic type parameters, also from the method to any concrete generic type. Issue: TNG#768 Signed-off-by: Timo Thomas <[email protected]>
Issue: TNG#768 Signed-off-by: Timo Thomas <[email protected]>
I'm very sorry, @ttho, that you didn't get any feedback so far. It's a sad reality that there we currently don't find much time. I'll try to take a look soon™. |
This should also fix #1137. |
During https://stackoverflow.com/questions/70507647/how-to-assert-hashmap-keys-to-be-comparable-with-archunit/70509141 we needed a way to analyze local variables.
Hence, I propose to extend JavaCodeUnit https://www.archunit.org/userguide/html/000_Index.html#_domain to also support local variable definition, declaration and initialization.
The text was updated successfully, but these errors were encountered: