skuzzle/restrict-imports-enforcer-rule

Allowing subpackages that are banned by a wildcard

evacchi opened this issue · 1 comments

I have the following configuration:

      <configuration>
          <rules>
              <restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
                  <reason>Allow only module imports</reason>
                  <bannedImports>
                      <bannedImport>org.kie.kogito.**</bannedImport>
                  </bannedImports>
                  <allowedImports>
                      <!-- we always allow process.* as these will be movable to internal -->
                      <allowedImport>org.kie.kogito.incubation.decisions.**</allowedImport>
                      <!-- we also allow common.*  -->
                      <allowedImport>org.kie.kogito.incubation.common.**</allowedImport>
                  </allowedImports>
              </restrictImports>
          </rules>
      </configuration>
                        

this class however causes an error:

package org.kie.kogito.incubation.processes.services;

import org.kie.kogito.incubation.common.DataContext;
import org.kie.kogito.incubation.processes.ProcessId;

public interface StraightThroughProcessService {
    DataContext evaluate(ProcessId processId, DataContext inputContext);
}

because of the rule:

<bannedImport>org.kie.kogito.**</bannedImport>

but I thought:

<allowedImport>org.kie.kogito.incubation.common.**</allowedImport>

would allow

import org.kie.kogito.incubation.common.DataContext;

what am I doing wrong? :)

... and as soon as I opened this I realized I was looking at the wrong pom.xml ! / smacks head