Bug 30844 - invalid "Can't find method" error
Summary: invalid "Can't find method" error
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-18 21:03 UTC by Nick Rizzolo
Modified: 2007-02-20 23:07 UTC (History)
2 users (show)

See Also:
Host: i386-redhat-linux
Target: i386-redhat-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
The code causing the problem. (140 bytes, text/plain)
2007-02-18 21:07 UTC, Nick Rizzolo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Rizzolo 2007-02-18 21:03:33 UTC
The following code, placed in a file named A.java, fails to compile with GCJ 4.1.0.  Sun's javac has no problem with it.  Interestingly, if you comment out the line marked with "/**/", the code compiles.

/* Begin A.java */
public class A
{
  public A() { }

  public int foo(Object a) { return 1; }
  public int foo(Object[] a) { return 1; }

  public static class B extends A
  {
    public B() { }
    /**/ public int foo(Object a) { return 1; }
  }

  public static class C extends B
  {
    public C() { }
    public int foo(Object[] a) { return super.foo(a); }
  }
}
/* End A.java */


The command I ran:
$ gcj4 -v -C A.java
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --with-gxx-include-dir=/usr/include/c++/3.4.3 --enable-libgcj-multifile --enable-languages=c,c++,java,f95 --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.0 20060515 (Red Hat 4.1.0-18)
 /usr/libexec/gcc/i386-redhat-linux/4.1.0/jc1 A.java -quiet -dumpbase A.java -mtune=generic -auxbase-strip NONE -g1 -version -fsyntax-only -femit-class-files -o A
GNU Java version 4.1.0 20060515 (Red Hat 4.1.0-18) (i386-redhat-linux)
        compiled by GNU C version 4.1.0 20060515 (Red Hat 4.1.0-18).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Class path starts here:
    ./
    /home/rizzolo/lib/
    /home/rizzolo/lib/java_cup.jar/ (zip)
    /home/rizzolo/cogcomp/LBP/LBJ2/
    /usr/share/java/libgcj-4.1.0.jar/ (system) (zip)
A.java: In class 'A$C':
A.java: In method 'A$C.foo(java.lang.Object[])':
A.java:18: error: Can't find method ‘foo([Ljava/lang/Object;)’ in type ‘A$B’. Candidates are:
  'A$B.foo(java.lang.Object)' in 'A$B'
  'A.foo(java.lang.Object[])' in 'A'.
    public int foo(Object[] a) { return super.foo(a); }
                                                 ^
1 error


By the way, it is not necessary for classes A, B, and C to be defined in the same file with B and C defined as static member classes of A.  The problem is also present when the three classes are defined in separate files and not as member classes.

 - Nick
Comment 1 Nick Rizzolo 2007-02-18 21:07:08 UTC
Created attachment 13065 [details]
The code causing the problem.
Comment 2 Tom Tromey 2007-02-20 02:16:12 UTC
FWIW we've basically stopped fixing bugs in the older gcj front end
and instead we've switched to using ecj.
I would close this as "wontfix" but that seems a bit harsh to do
unannounced... so with your permission I'd like to.
Comment 3 Nick Rizzolo 2007-02-20 03:25:28 UTC
Subject: Re:  invalid "Can't find method" error

Ya gotta do what ya gotta do.

Thanks,
 - Nick


On 20 Feb 2007 02:16:12 -0000, tromey at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #2 from tromey at gcc dot gnu dot org  2007-02-20 02:16 -------
> FWIW we've basically stopped fixing bugs in the older gcj front end
> and instead we've switched to using ecj.
> I would close this as "wontfix" but that seems a bit harsh to do
> unannounced... so with your permission I'd like to.
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30844
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
Comment 4 Tom Tromey 2007-02-20 23:07:41 UTC
Fixed on trunk.