When we issue errors and warnings, we always target the element that we are processing:
But since JAVA-2111, this element can be inherited:
The problem is if ParentDao is already compiled: for example, it's in a JAR that the current project depends on. methodElement doesn't correspond to a location in the source code, the compiler cannot provide any context for the error:
For reference, this is how it would look if the method was defined directly in ConcreteDao:
We should detect that situation, and try to provide better context. I think the best thing we can do is target the type element of the child type (e.g. ConcreteDao). So instead of methodElement, use interfaceElement (available in the DAO generator). We can even provide the name of the offending method in the message.