Skip to content
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

Make AnalyzeClasses inherited #932

Closed
wants to merge 1 commit into from
Closed

Make AnalyzeClasses inherited #932

wants to merge 1 commit into from

Conversation

zsoltkatona
Copy link

I'd propose this change so a common configuration for the AnalyzeClasses annotation can be set in a common superclass for ArchUnit test classes within a project:

@AnalyzeClasses(packages = "com.example.service", importOptions = {DoNotIncludeTests.class, DoNotIncludeSomething.class})
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface ArchRulesTest {
    ...
}

@ArchRulesTest
public class SecurityArchitecturePolicies {
    ...
}

@ArchRulesTest
public class MappingFrameworkPolicies {
    ...
}

@ArchRulesTest
public class LayeredArchitecturePolicies {
    ...
}

I haven't actually tested this, so this is just a recommendation - if you'd like me to fork the repo, create tests, etc. please let me know and I'll see when I'll be able to get to it.

I'd propose this change so a common configuration for the AnalyzeClasses annotation can be set in a common superclass for ArchUnit test classes within a project:
```
@AnalyzeClasses(packages = "com.example.service", importOptions = {DoNotIncludeTests.class, DoNotIncludeSomething.class})
@target(ElementType.TYPE)
@retention(RetentionPolicy.RUNTIME)
@inherited
public @interface ArchRulesTest {
    ...
}

@ArchRulesTest
public class SecurityArchitecturePolicies {
    ...
}

@ArchRulesTest
public class MappingFrameworkPolicies {
    ...
}

@ArchRulesTest
public class LayeredArchitecturePolicies {
    ...
}
```
I haven't actually tested this, so this is just a recommendation - if you'd like me to fork the repo, create tests, etc. please let me know and I'll see when I'll be able to get to it.
@codecholeric
Copy link
Collaborator

Just to clarify, are you proposing the same as suggested here: #182 ?

Please be careful when using the word "inherit" 😉 Because it can also easily be understood in an OO way that you talk about object inheritance. You are talking about using @AnalyzeClasses as a meta-annotation if I understand you correctly?

@codecholeric
Copy link
Collaborator

And unfortunately adding @Inherited will AFAIS not really contribute to this? Or maybe you can explain why you think that @Inherited (given the respective docs) would have any influence on this?

@codecholeric
Copy link
Collaborator

Gonna close this since there has been no activity for a long time. Feel free to reopen if you want to revisit this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants