-
Notifications
You must be signed in to change notification settings - Fork 86
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
Support wildcards in target() #248
Comments
That would indeed be a new Feature. It might make pointcut matching for Due to "development team" capacity - currently just me in tiny time slices - I think this is not going to be implemented anytime soon. But often there are ways to achieve what developers want by other means. If you could provide an MCVE GitHub project and point to it in a Stack Overflow question, I might be able to help you with your workaround. Maybe what you so at present is already the best workaround imaginable, but I have no way of knowing for sure. Are you having performance problems due to your aspect? Did you measure that somehow? |
Thanks for the quick reply. Your answer suggest me that what I am doing now - inspecting the type in the aspect code - is what AspectJ would have to do internally if it implemented this anyway. So the "more efficient way" comes down to solely a more efficient way to express this. Still it would be a nice feature. |
Yes, basically that is so. The pointcut types I listed above, among others, are always evaluated during runtime. The complexity would just be hidden inside AspectJ. But like I said, maybe there is a way to do what you want more elegantly with on-board means. I have no way of knowing, only reading your textual description and not seeing the actual code. |
Yes, I understand, and your help would be much appreciated. However, the future of this feature I was working on is currently unclear for other reasons. |
Hi, this is a question and a request for enhancement. Why can't I use wildcards in target() expressions like in
target(java.util.concurrent..*)
?This gives me the error message
wildcard type pattern not allowed, must use type name
Background:
I want to check if threads aren't concurrently accessing thread-unsafe collection classes, and exclude all classes in
java.util.concurrent
. For that, I track access to objects with an aspect and report an error if two threads access it at the same time. If I use the pointcutcall(* java.util.concurrent..*(..))
instead, it does match on all methods defined in this package, but does not match the method calls coming through an interface outside of that package, likejava.util.List.add()
for example.My workaround is to check the class name of the target object on every call interception, but I would like to have a more efficient way.
The text was updated successfully, but these errors were encountered: