* @see #constant_pool_entries_satisfy_static_constraints()
* @see #every_class_has_an_accessible_superclass()
*/
private void final_methods_are_not_overridden(){
HashMap hashmap = new HashMap();
JavaClass jc = Repository.lookupClass(myOwner.getClassName());
int supidx = -1;
while (supidx != 0){
supidx = jc.getSuperclassNameIndex();
Method[] methods = jc.getMethods();
for (int i=0; i<methods.length; i++){
String name_and_sig = (methods[i].getName()+methods[i].getSignature());
if (hashmap.containsKey(name_and_sig)){
if (methods[i].isFinal()){
throw new ClassConstraintException("Method '"+name_and_sig+"' in class '"+hashmap.get(name_and_sig)+"' overrides the final (not-overridable) definition in class '"+jc.getClassName()+"'.");
}
else{
if (!methods[i].isStatic()){ // static methods don't inherit
hashmap.put(name_and_sig, jc.getClassName());
}
}
}
else{
if (!methods[i].isStatic()){ // static methods don't inherit
hashmap.put(name_and_sig, jc.getClassName());
}
}
}
jc = Repository.lookupClass(jc.getSuperclassName()); // Well, for OBJECT this returns OBJECT so it works (could return anything but must not throw an Exception).
}
}