<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2013-2022 TU Dortmund
This file is part of LearnLib, http://www.learnlib.de/.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<FindBugsFilter>
    <Match>
        <!-- Could be refactored ... -->
        <Bug pattern="NM_CLASS_NOT_EXCEPTION"/>
        <Class name="de.learnlib.mapper.api.SULMapper$MappedException"/>
    </Match>
    <Match>
        <!-- TODO: mostly due to performance. However, usage should be checked again -->
        <Bug pattern="EI_EXPOSE_REP2"/>
        <Or>
            <Class name="de.learnlib.drivers.reflect.MethodInput"/>
        </Or>
    </Match>
    <Match>
        <!-- TODO: SpotBugs seem to incorrectly infer type annotations, https://github.com/spotbugs/spotbugs/issues/643
                   We have CheckerFramework for this anyway -->
        <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/>
    </Match>
    <Match>
        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
        <Or>
            <!-- SpotBugs doesn't detect that only the inner type is nullable -->
            <And>
                <Class name="de.learnlib.api.oracle.LassoOracle"/>
                <Method name="findCounterExample"/>
            </And>
            <And>
                <Class name="de.learnlib.api.oracle.SingleQueryOmegaOracle"/>
                <Method name="processQuery"/>
            </And>
            <And>
                <Class name="de.learnlib.oracle.membership.AbstractSULOmegaOracle"/>
                <Method name="processQueries"/>
            </And>
            <And>
                <Class name="de.learnlib.util.MQUtil"/>
                <Method name="answerOmegaQueries"/>
            </And>
            <And>
                <Class name="de.learnlib.filter.reuse.tree.ReuseTree"/>
                <Method name="disposeSystemStates"/>
            </And>
            <And>
                <Class name="de.learnlib.examples.Example3"/>
                <Method name="main"/>
            </And>
            <!-- SpotBugs doesn't understand pure functions -->
            <And>
                <Class name="de.learnlib.algorithms.adt.adt.ADT"/>
                <Or>
                    <Method name="findLCA"/>
                    <Method name="replaceNode"/>
                </Or>
            </And>
            <And>
                <Class name="de.learnlib.algorithms.discriminationtree.hypothesis.vpda.TransList"/>
                <Or>
                    <Method name="poll"/>
                    <Method name="addAll"/>
                </Or>
            </And>
            <And>
                <Class name="de.learnlib.algorithms.ttt.base.IncomingList"/>
                <Method name="insertAllIncoming"/>
            </And>
            <And>
                <Class name="de.learnlib.algorithms.adt.util.ADTUtil"/>
                <Method name="getStartOfADS"/>
            </And>
            <And>
                <!-- SpotBugs doesn't understand conditional non-nulls -->
                <Class name="de.learnlib.algorithms.adt.config.LeafSplitters"/>
                <Method name="splitParent"/>
            </And>
            <And>
                <!-- The node(s) was(were) selected such that getHypothesisState is NOT null -->
                <Class name="de.learnlib.algorithms.adt.learner.ADTLearner"/>
                <Or>
                    <Method name="refineHypothesisInternal"/>
                    <Method name="resiftAffectedTransitions"/>
                </Or>
            </And>
        </Or>
    </Match>
    <Match>
        <!-- Still a false-positive on Java 11. See https://github.com/spotbugs/spotbugs/issues/259 -->
        <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
        <Or>
            <Class name="de.learnlib.examples.dfa.DFABenchmarks"/>
        </Or>
    </Match>
</FindBugsFilter>