Bug 20697 - Invalid Can't find method error on call to super
Summary: Invalid Can't find method error on call to super
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 3.4.3
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
: 22060 (view as bug list)
Depends on: 18119
Blocks: 18131
  Show dependency treegraph
 
Reported: 2005-03-30 23:42 UTC by David Daney
Modified: 2005-07-07 14:50 UTC (History)
3 users (show)

See Also:
Host: i386-redhat-linux
Target: i386-redhat-linux
Build: i386-redhat-linux
Known to work:
Known to fail: 3.4.3 4.0.0
Last reconfirmed: 2005-03-31 00:24:37


Attachments
Testcase part1 (103 bytes, text/plain)
2005-03-30 23:43 UTC, David Daney
Details
Testcase part2 (69 bytes, text/plain)
2005-03-30 23:43 UTC, David Daney
Details
Testcase part3 (115 bytes, text/plain)
2005-03-30 23:44 UTC, David Daney
Details
First part of smaller testcase. (104 bytes, text/plain)
2005-03-30 23:56 UTC, David Daney
Details
Second part of smaller testcase. (81 bytes, text/plain)
2005-03-30 23:58 UTC, David Daney
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Daney 2005-03-30 23:42:07 UTC
When the testcase is compiled like this:

$ gcj -o A --main=C A.java B.java C.java
C.java: In class `C':
C.java: In method `C.m()':
C.java:5: error: Can't find method `m()' in type `B'. Candidates are:
  `B.m()' in `B'
  `A$A1.m()' in `A$A1'.
           super.m();
                 ^
1 error

We get the error shown above.  However with Sun's javac:
$ javac -g A.java B.java C.java

No errors are obtained.

I will attach the three files A.java B.java and C.java
Comment 1 David Daney 2005-03-30 23:43:11 UTC
Created attachment 8499 [details]
Testcase part1
Comment 2 David Daney 2005-03-30 23:43:38 UTC
Created attachment 8500 [details]
Testcase part2
Comment 3 David Daney 2005-03-30 23:44:04 UTC
Created attachment 8501 [details]
Testcase part3
Comment 4 David Daney 2005-03-30 23:45:18 UTC
I should add that I think this is a target independent bug as it also fails for
a mipsel-linux target.
Comment 5 David Daney 2005-03-30 23:55:23 UTC
If you modify the testcase file A.java so that the inner class A1 is no longer
static, the testcase converts to an ice-on-invalid-code.
Comment 6 David Daney 2005-03-30 23:56:52 UTC
Created attachment 8502 [details]
First part of smaller testcase.
Comment 7 David Daney 2005-03-30 23:58:35 UTC
Created attachment 8503 [details]
Second part of smaller testcase.

New Testcase.  I think it is the same problem.

$ gcj A1.java B1.java
B1.java: In class `B1':
B1.java: In method `B1.n()':
B1.java:10: error: Can't find method `m()' in type `B1'. Candidates are:
  `B1.m()' in `B1'
  `A1$A2.m()' in `A1$A2'.
	   m();
	   ^
1 error
Comment 8 Andrew Pinski 2005-03-31 00:24:37 UTC
Confirmed, I think this is a dup of bug 18119.
Comment 9 Bryce McKinlay 2005-06-15 21:43:27 UTC
I'm testing a fix. This is a different problem to 18131.
Comment 10 Bryce McKinlay 2005-06-15 21:44:18 UTC
Err, 18119 I mean.
Comment 11 Bryce McKinlay 2005-06-15 22:07:06 UTC
*** Bug 22060 has been marked as a duplicate of this bug. ***
Comment 12 GCC Commits 2005-06-23 15:01:25 UTC
Subject: Bug 20697

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bryce@gcc.gnu.org	2005-06-23 15:01:05

Modified files:
	gcc/java       : ChangeLog parse.y 
	libjava        : ChangeLog 
Added files:
	libjava/testsuite/libjava.compile: PR20697.java 

Log message:
	PR java/20697
	* parse.y (find_most_specific_methods_list): Remove special case for
	inner classes.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1630&r2=1.1631
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.539&r2=1.540
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR20697.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3673&r2=1.3674

Comment 13 Bryce McKinlay 2005-06-23 15:02:12 UTC
Fix checked in.