Open henrykuijpers opened 11 months ago
I will look into this but I'm not sure whether this is doable. It depends on whether maven actually calls the setter twice when binding the XML values to the model. If it does, then adding a check should be fairly simple. If it doesn't, then adding a check for this might be impossible.
Actually, if the setter would be called twice we could consider getting rid of the bannedImports
element altogether
@henrykuijpers Could you please post your configuration? I just tried the following:
<configuration>
<rules>
<RestrictImports>
<bannedImport>java.util.*</bannedImport>
<bannedImport>java.*</bannedImport>
</RestrictImports>
</rules>
</configuration>
And it fails with the following message:
Caused by: java.lang.IllegalArgumentException: If you want to specify multiple banned imports you have to wrap them in a <bannedImports> tag
We had a few configurations in our project, that had multiple bannedImport-elements. The first (or the last) is only considered, the others are ignored.
We should add something to prevent this from happening.