Bug 15964 - gcc java does not understand static variables in inner class
Summary: gcc java does not understand static variables in inner class
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-08-10 23:59 UTC by mal
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-12-15 01:01:30 UTC
Embargoed:


Attachments (Terms of Use)

Description mal 2000-08-10 23:59:43 UTC
gcc --version
2.96
(RedHat 7.0 Public Beta)

gcc java does not understand
static variables in inner class.
gcj Y.java Y2.java -o x --main=Y2
Y2.java: In class `Y2':
Y2.java: In method `main(java.lang.String[])':
Y2.java:4: No variable `UU' defined in type `Y'.
  System.err.println(Y.UU.V);
                      ^
1 error



 cat Y2.java
class Y2 {
 public static void main(String [] args)
 {
  System.err.println(Y.UU.V);
 }
}


cat Y.java
public class Y {
public static class UU {
 public static final String V="V";
}
public static void main(String [] args)
{
 System.err.println(Y.UU.V);
}
}

Comment 1 mal 2000-08-13 22:36:46 UTC
Should be fixed in 
http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00516.html

Comment 2 mal 2000-08-21 13:50:33 UTC
The problem still exists in 
rpm -q gcc-java
gcc-java-2.96-53

but the error message noe is different

[mal@eth0_extrenal tgcc]$ gcj -c Y.java Y2.java 
Y2.java:4: Cannot find file for class Y$UU.

but jikes is OK with this
[mal@eth0_extrenal t2gcc]$ jikes Y.java Y2.java 
[mal@eth0_extrenal t2gcc]$ 

I will try contact Alexandre Petit-Bianco <apbianco> 
about this.

Comment 3 mal 2000-08-21 14:34:16 UTC
Also, if you compile it by other java compiler,
so file Y$UU.class is created,
then gcj works OK.
Because of some reason it does not generate Y$UU.class 
by itself.

Comment 4 Alan Cox 2002-12-15 01:01:30 UTC
Confirmed OK in 8.0



Note You need to log in before you can comment on or make changes to this bug.