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

Replace deprecated EnforcerRule and EnforcerRule2 implementations #90

Open
skuzzle opened this issue Jul 5, 2023 · 1 comment
Open

Comments

@skuzzle
Copy link
Owner

skuzzle commented Jul 5, 2023

The interfaces EnforcerRule and EnforcerRule2 have been deprecated in favor of the new abstract class AbstractEnforcerRule. However this poses a big problem as our rule implementation already need to inherit from BannedImportGroupDefinition in order to provide convenient XML configuration.

We probably need to give up on the convenience configuration in order to get rid of the deprecations.

Currently it is possible to either configure a single banned group or multiple groups. When configuring a single group, this group does not need to be nested in <groups></groups>. This is achieved by inheriting from BannedImportGroupDefinition.

Changing this would break existing rule usages and introduce inconveniences when configuring the rule for simple use cases

See also: https://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html

@skuzzle
Copy link
Owner Author

skuzzle commented Jul 6, 2023

I reckon we could still make this work by not inheriting from BannedImportGroupDefinition and instead copy its contents to the rule implementation. That's ugly to maintain though
Just tried it out and it was pretty straight forward. Instead of delegating to the super class, we can just delegate to an actual instance of BannedImportGroupDefinition.

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

No branches or pull requests

1 participant