When trying to compile javax/swing/text/InternationalFormatter.java the compiler gets confused about which super class it should use for the clone() method: /usr/local/gcc41/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../vm/reference:../external/w3c_dom:../external/sax:.: -C -d . @classes.standardx ../javax/swing/text/InternationalFormatter.java: In class 'javax.swing.text.InternationalFormatter': ../javax/swing/text/InternationalFormatter.java: In method 'javax.swing.text.InternationalFormatter.clone()': ../javax/swing/text/InternationalFormatter.java:339: error: Can't find method 'clone()' in type 'javax.swing.text.DefaultFormatter'. Candidates are: 'javax.swing.text.DefaultFormatter.clone()' in 'javax.swing.text.DefaultFormatter' 'javax.swing.JFormattedTextField$AbstractFormatter.clone()' in 'javax.swing.JFormattedTextField$AbstractFormatter'. return super.clone(); ^ 1 error For now we have disabled the whole clone() method in this class.
Looks like a compiler bug. It should be clear that it should call the clone method of DefaultFormatter, shouldn't it? Jikes doesn't seem to have a problem with it. Disabling this method as a workaround will not hurt much, so go ahead.
Created attachment 9086 [details] Simplified testcase. A simplified testcase for the problem. Note that the problem only seems to happen when the base class is an inner class. Note also that if I omit "static" from line #3 in the testcase, the compiler ICEs.
I looked at this a little bit. There are two choices for the problem here. One is that find_applicable_accessible_methods_list is returning too much. For the call in question, it returns Object.clone, Inner.clone, and Bar.clone However, this seems to be what is intended. The second choice for the problem is that find_most_specific_methods_list is not correctly removing Inner.clone from the list of most specific methods. This function is a bit strange in that it has special cases for inner classes, e.g.: int v = (DECL_SPECIFIC_COUNT (current_v) += (INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v)) ? 2 : 1)); ... which don't make sense to me.
This looks like a dup of bug 20697
*** This bug has been marked as a duplicate of 20697 ***