Unfortunately, you cannot say this from bytecode. @Override annotations are only advisory - this is not necessary.
The JVM defines 5 ways to invoke a method. They are invokevirtual, invokeinterface, invokespecial, invokestatic and new invokedynamic.
The focus on invokevirtual is the most common form of submission and is used for the case you are talking about.
The way invokevirtual works is that at runtime it looks at the class of the object you are sending. If he finds an implementation of the method that we need, he calls it. If not, then he looks at the superclass of the feature class and tries again, etc.
Thus, there is no way from the bytecode to reliably determine whether a given method is overridden without looking at the bytecode for the parent class.
source share