Bug 22060 - javax/swing/text/InternationalFormatter.clone() doesn't compile (GNU Classpath)
Summary: javax/swing/text/InternationalFormatter.clone() doesn't compile (GNU Classpath)
Status: RESOLVED DUPLICATE of bug 20697
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-14 10:45 UTC by Mark Wielaard
Modified: 2005-06-15 22:07 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.0.0 4.1.0
Last reconfirmed: 2005-06-14 11:44:37


Attachments
Simplified testcase. (230 bytes, text/plain)
2005-06-14 11:43 UTC, Ranjit Mathew
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2005-06-14 10:45:19 UTC
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.
Comment 1 Roman Kennke 2005-06-14 10:48:39 UTC
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.
Comment 2 Ranjit Mathew 2005-06-14 11:43:34 UTC
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.
Comment 3 Tom Tromey 2005-06-15 19:42:48 UTC
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.
Comment 4 Tom Tromey 2005-06-15 20:13:47 UTC
This looks like a dup of bug 20697
Comment 5 Bryce McKinlay 2005-06-15 22:07:03 UTC

*** This bug has been marked as a duplicate of 20697 ***