Bug 8544

Summary: Inner interface's are not know inside package's
Product: gcc Reporter: otmar.struwe
Component: javaAssignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: bugs, gcc-bugs, jakub, jakub, java-prs, richardl
Priority: P3 Keywords: rejects-valid
Version: 3.2   
Target Milestone: 4.3.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2005-07-23 05:24:21
Bug Depends on: 28067    
Bug Blocks: 18131    

Description otmar.struwe 2002-11-12 03:56:02 UTC
With jdk-1.3.1 it's possible to use inner interfaces inside the package. GCC does not compile the example below, but the jdk-1.3.1 does.


  package test_pack;

  import test_pack.StyledText.*;

  class DisplayRenderer {
     StyledText text;
  DisplayRenderer(StyledText parent ) {
     text = parent;

  protected void test() {
	LineCache lineCache; 


  package test_pack;

  public class StyledText {
	LineCache lineCache;

  public StyledText(int a){
  public LineCache getCache() {
    return lineCache;

  interface LineCache {

    public void calculate(int startLine, int lineCount);

  } // end LineCache 
  } // end StyledText

  $ gcj -C test_pack/*.java

you get

  test_pack/DisplayRenderer.java:13: Type `LineCache' not
  found in the declaration
  of the local variable `lineCache'.
        LineCache lineCache;
  1 error

gcc 3.2 and gcc 3.1.1

$ gcj -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../libgcj.spec
rename spec lib to liborig
Configured with: /netrel/src/gcc-3.2-1/configure --enable-languages=c,c++,f77,java
--enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls
--without-included-gettext --enable-interpreter --disable-sjlj-exceptions 
--disable-version-specific-runtime-libs --enable-shared --build=i686-pc-linux
--host=i686-pc-cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr 
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib 
--includedir=/nonexistent/include --libexecdir=/usr/sbin
Thread model: posix
gcc version 3.2 20020818 (prerelease)

the same problem was seen with gcc-3.1.1 on linux
Comment 1 Andrew Pinski 2003-05-25 22:57:44 UTC
Confirmed on mainline (20030525):
tin:~/src/gnu/gcctest>gcj -C test_pack/*.java
test_pack/DisplayRenderer.java:15: error: Type `LineCache' not found in the declaration 
of the local variable `lineCache'.
        LineCache lineCache; 
1 error
tin:~/src/gnu/gcctest>javac  test_pack/*.java
Comment 2 Richard Li 2004-01-20 21:18:15 UTC
This bug precludes the use of java.util.Map.Entry, which is a J2SE class library
that follows this pattern.

I can confirm that this happens on a recent build: 

[richardl@andrew cms]$ gij -version
gij (GNU libgcj) version 3.5.0 20040119 (experimental)
Comment 3 Tom Tromey 2004-01-21 00:43:05 UTC
FYI, you can work around this by writing "StyledText.LineCache"
instead of just "LineCache".  I realize this isn't always feasible though.
Comment 4 Elliot Lee 2004-08-12 19:45:07 UTC
I'm still running into this with gcj-3.4.1 while building eclipse.
Comment 5 Jakub Jelinek 2005-11-11 12:12:43 UTC
*** Bug 24792 has been marked as a duplicate of this bug. ***
Comment 6 Tom Tromey 2007-01-09 20:44:13 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.