I'm getting hit by "Overriding method merely calls
super" for cases like the one below. In fact, the
overriding method does noe merely call super. It also
changes the method's access specifier from protected to
public so it can be direclty invoked. This is a
significant change that should not be flagged. I would
believe this rule if I weren't changing the access
specifier but since I am, it shoudln't be caught.
probably the same thing would apply if the subclass
made the method final to prevent further overrides.
// just so we can test protected methods
private static class ExposingSerializer extends
Serializer {
ExposingSerializer(OutputStream out, String
encoding)
throws UnsupportedEncodingException {
super(out, encoding);
}
public void writeChild(Node node) throws
IOException {
super.writeChild(node);
}
public void exposedWriteRaw(String text) throws
IOException {
writeRaw(text);
}
public void exposedWriteEscaped(String text)
throws IOException {
writeEscaped(text);
}
public void exposedWriteAttributeValue(String
text) throws IOException {
writeAttributeValue(text);
}
public int exposeGetColumnNumber() {
return super.getColumnNumber();
}
}
Logged In: YES
user_id=1310018
how about 'synchronized' in this context?
synchronized void method() {
super.method();
}
Logged In: YES
user_id=555114
Originator: NO
Synchronized methods weren't flagged anymore as of 2006-10-26. Detecting the differing access specifiers requires type resolution to find out the access specifier of the superclass. Currently, this is not available.
See https://github.com/pmd/pmd/issues/911