Bug 15964 - gcc java does not understand static variables in inner class
gcc java does not understand static variables in inner class
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-08-10 19:59 EDT by mal
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-14 20:01:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description mal 2000-08-10 19:59:43 EDT
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 18:36:46 EDT
Should be fixed in 
http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00516.html
Comment 2 mal 2000-08-21 09:50:33 EDT
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@cygnus.com> 
about this.
Comment 3 mal 2000-08-21 10:34:16 EDT
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-14 20:01:30 EST
Confirmed OK in 8.0

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