public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/1247: gcj fails to compile this 1.1 innerclass code
@ 2000-12-20 12:23 mdejong
  0 siblings, 0 replies; only message in thread
From: mdejong @ 2000-12-20 12:23 UTC (permalink / raw)
  To: java-gnats

>Number:         1247
>Category:       java
>Synopsis:       gcj fails to compile this 1.1 innerclass code
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    apbianco
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:18:14 PST 2000
>Closed-Date:    Sun Dec 17 00:32:11 PST 2000
>Last-Modified:  Sun Dec 17 00:40:00 PST 2000
>Originator:     Mo
>Release:        Sourceware CVS
>Organization:
>Environment:
Linux Box.
>Description:
% cat DefaultStaticInnerClass_InPackage.java
// File DefaultStaticInnerClass_InPackage.java

package foo;

public class DefaultStaticInnerClass_InPackage {

    static class Inner {}

    static class Inner_Test {
      Inner in;
    }

}

// This test just makes sure the fully qualified name can be used.

class DefaultStaticInnerClass_InPackage_Test {
  DefaultStaticInnerClass_InPackage.Inner f;
}



% cat DefaultStaticInnerClass_InPackage_ExternalTest.java
// File DefaultStaticInnerClass_InPackage_ExternalTest.java

package foo;

// This test makes sure an inner class from inside the
// same package can be used.

public class DefaultStaticInnerClass_InPackage_ExternalTest {
  DefaultStaticInnerClass_InPackage.Inner f;
}



When run with gcj from sourceware, I get the following result:

% gcj -C DefaultStaticInnerClass_InPackage.java \
         DefaultStaticInnerClass_InPackage_ExternalTest.java
foo/DefaultStaticInnerClass_InPackage.java:0: Cannot find file for class foo.DefaultStaticInnerClass_InPackage$Inner.


This same code compiles just fine with javac and jikes.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:

Formerly PR gcj/223


From: Bryce McKinlay <bryce@albatross.co.nz>
To: mdejong@cygnus.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/223: gcj fails to compile this 1.1 innerclass code
Date: Mon, 08 May 2000 18:30:52 +1200

 mdejong@cygnus.com wrote:
 
 > >Synopsis:       gcj fails to compile this 1.1 innerclass code
 
 I dont think this is really a problem specific to inner classes, but rather more general issues with the way gcj
 resolves nested package/class/inner class/field names and finds packages.
 
 For example, the following code also fails:
 
 // in "pkg"
 
 package pkg;
 
 public class A
 {
   public static String f = "f";
 }
 
 // in "pkg/pkg"
 
 package pkg.pkg;
 
 public class B
 {
   static String c = pkg.A.f;
 }
 
 Trying to compile them from within "pkg" I get:
 
 $ gcj -C A.java pkg/B.java
 pkg/B.java: In class `pkg.pkg.B':
 pkg/B.java: In method `<clinit>()':
 pkg/B.java:5: Undefined variable or class name: `pkg'.
   static String c = pkg.A.f;
                     ^
 1 error
 
 Trying to compile from the top level gives a different error:
 
 $ gcj -C pkg/A.java pkg/pkg/B.java
 pkg/pkg/B.java: In class `pkg.pkg.B':
 pkg/pkg/B.java: In method `<clinit>()':
 pkg/pkg/B.java:5: Incompatible type for declaration. Can't convert `pkg.A' to `java.lang.String'.
   static String c = pkg.A.f;
                 ^
 1 error
 
 With javac or jikes it works either way.
 
 regards
 
   [ bryce ]
 
 
State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Sun Dec 17 00:32:11 2000
State-Changed-Why:
    This test case now works fine on the current cvs compiler 
    provided that gcj is invoked from the top level of the package
    heirachy, or the top level directory is present in CLASSPATH.
    
    gcj -C doesn't work like jikes or javac here, but this issue
    is covered by gcj/346.

From: bryce@albatross.co.nz
To: apbianco@cygnus.com, java-gnats@sourceware.cygnus.com, mdejong@cygnus.com
Cc:  
Subject: Re: gcj/223
Date: 17 Dec 2000 08:32:11 -0000

 Synopsis: gcj fails to compile this 1.1 innerclass code
 
 State-Changed-From-To: open->closed
 State-Changed-By: bryce
 State-Changed-When: Sun Dec 17 00:32:11 2000
 State-Changed-Why:
     This test case now works fine on the current cvs compiler 
     provided that gcj is invoked from the top level of the package
     heirachy, or the top level directory is present in CLASSPATH.
     
     gcj -C doesn't work like jikes or javac here, but this issue
     is covered by gcj/346.
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=223&database=java
>Unformatted:



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-12-20 12:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 12:23 java/1247: gcj fails to compile this 1.1 innerclass code mdejong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).