UnsupportedOperationException: Trying to save symbol table twice for the same file is not supported

sonar-plugin-api: 7.4

creating own java rules, so implementing a new scanner that is using org.sonar.java.JavaSquid
languageKey: hybrisjava
languageDeafultFileSuffixes: .java

Sensor:

public class HybrisJavaSquidSensor implements Sensor {

    private static final Logger LOG = Loggers.get(HybrisJavaSquidSensor.class);

    private final SonarComponents sonarComponents;
    private final FileSystem fs;
    private final JavaResourceLocator javaResourceLocator;
    private final Configuration settings;
    private final NoSonarFilter noSonarFilter;
    private final PostAnalysisIssueFilter postAnalysisIssueFilter;

    public HybrisJavaSquidSensor(SonarComponents sonarComponents, FileSystem fs, JavaResourceLocator javaResourceLocator,
                                 Configuration settings, NoSonarFilter noSonarFilter, PostAnalysisIssueFilter postAnalysisIssueFilter) {
        this.noSonarFilter = noSonarFilter;
        this.sonarComponents = sonarComponents;
        this.fs = fs;
        this.javaResourceLocator = javaResourceLocator;
        this.settings = settings;

        HybrisJavaCheckRepository.setSettings(settings);
        this.postAnalysisIssueFilter = postAnalysisIssueFilter;

    }

    @Override
    public void describe(SensorDescriptor descriptor) {
        descriptor.onlyOnLanguage(HybrisJavaLanguage.KEY).name("HybrisJavaSquidSensor");
    }

    @Override
    public void execute(SensorContext context) {
        sonarComponents.setSensorContext(context);
        sonarComponents.registerCheckClasses(HybrisJavaCheckRepository.REPOSITORY_KEY, HybrisJavaCheckRepository.getJavaChecks());
        sonarComponents.registerTestCheckClasses(HybrisJavaCheckRepository.REPOSITORY_KEY, HybrisJavaCheckRepository.getJavaTestChecks());

        Measurer measurer = new Measurer(context, noSonarFilter);

        JavaSquid squid = new JavaSquid(getJavaVersion(), sonarComponents, measurer, javaResourceLocator,
                postAnalysisIssueFilter, sonarComponents.checkClasses());
        squid.scan(getSourceFiles(), getTestFiles());

        sonarComponents.saveAnalysisErrors();
    }
...
}

StackTrace:

org.sonar.java.AnalysisException: SonarQube is unable to analyze file : 'hybris/bin/aokcommon/aokcommonaddon/src/de/aoksystems/aok/common/addon/constants/AokcommonaddonConstants.java'
	at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:99)
	at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:67)
	at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:115)
	at org.sonar.java.JavaSquid.scan(JavaSquid.java:109)
	at de.aoksystems.sonar.java.HybrisJavaSquidSensor.execute(HybrisJavaSquidSensor.java:64)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.UnsupportedOperationException: Trying to save symbol table twice for the same file is not supported: hybris/bin/aokcommon/aokcommonaddon/src/de/aoksystems/aok/common/addon/constants/AokcommonaddonConstants.java
	at org.sonar.scanner.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:296)
	at org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable.doSave(DefaultSymbolTable.java:142)
	at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:45)
	at org.sonar.java.ast.visitors.SonarSymbolTableVisitor.visitCompilationUnit(SonarSymbolTableVisitor.java:61)
	at org.sonar.java.model.VisitorsBridge.createSonarSymbolTable(VisitorsBridge.java:221)
	at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:129)
	at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:90)
	... 34 more

Hello @VaSie,

Before going further, did you have a look at Writing Custom Java Rules 101?

I believe this link will greatly help you!

Feel free to reach us back is something is not clear.

Best,
Quentin