-
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 classes().that().areAnyClass(...) to syntax #173
Conversation
Sorry for the long break, I had a crazy month at work. I thought about this, and I think the only way it makes sense to me, is to treat anonymous and named inner classes the same. Because conceptually they are almost the same, so I don't see why the rule should be satisfied as long as my inner class has no name and suddenly fail just because I give it a name. This seems to be more driven by a specific use case, that excluding anonymous classes makes the feature really less useful. |
Would creating 3 separate functions |
I like the multiple function approach. I get that the behavior is weird between named and un-named inner classes. In Java 8 and forward lambdas are everywhere. People use them for filtering streams. They use them unknowingly sometimes, or at least the implementation detail of an anonymous class is unknown. I don't like that this implementation detail is leaking up into the archunit tests. But at the same time, those lambdas are another class so I get why it needs to be treated separately if you actually did care about creating rules where inner classes are different. |
bc60ff8
to
5cc80f8
Compare
DeepCode analyzed this pull request. Click to see more details. |
I've added some changes. I would not distinguish here, because we already have the exact case by |
Could you check this out if it would match your use case? I don't think it provides any extensive value to exclude named classes as I said. |
5cc80f8
to
40e8587
Compare
This seems to pretty closely match our use case. Matching against a class and all its inner classes is the best way to go, in my opinion. Could you confirm @cakeface ? |
If you don't have any objections, I'll merge this 😉 |
Please go ahead! |
Signed-off-by: Mobolaji Adefope <mbadefop@edu.uwaterloo.ca>
Signed-off-by: Mobolaji Adefope <mbadefop@edu.uwaterloo.ca>
Signed-off-by: Mobolaji Adefope <mbadefop@edu.uwaterloo.ca>
…r classes the same, be they anonymous or named. Thus call the method "belongTo" and define "belong" as being the class or any nested inner class. We should extend that to nested levels as well, since using an anonymous class within an anonymous class should not be counted any different IMHO. Also improved tests a little to actually test the nested case which is the more interesting one. Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
40e8587
to
c90991f
Compare
Add classes().that().areAnyClass(...) to syntax
Lost push access to toasttab fork in #167 so created this PR.