Search code examples
javaintellij-ideaibatismybatis

Unchecked Overriding when defining a base mapper for mybatis?


I'm trying to define a base mapper interface for MyBatis. I've tried this:

public interface IMapper<T> {
    <T> T select(int id);
}

public interface FooMapper extends IMapper<Foo>{
    @Override
    @Select("SELECT * FROM foos WHERE id = {#id}")
    Foo select(int id);
}

But I'm getting Unchecked Overriding warnings from IntelliJ. Should I disable them, or am I really doing something wrong?


Solution

  • Remove the extra <T> on the select method so it is:

    interface IMapper<T> {
        T select(int id);
    }