java/4366: java class initialization bug
Anthony Green
green@cygnus.com
Thu Sep 20 01:06:00 GMT 2001
>Number: 4366
>Category: java
>Synopsis: java class initialization bug
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Sep 20 01:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Anthony Green
>Release: 3.1 20010919 (experimental)
>Organization:
>Environment:
System: Linux fencer.cygnus.com 2.2.12-20smp #1 SMP Mon Sep 27 10:34:45 EDT 1999 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /fencer/cutlass/aph/green/trunk/gcc/configure --prefix=/fencer/cutlass/aph/green/trunk/gcc/i --enable-threads --enable-languages=c++,java : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured)
>Description:
I've found a situation where references to static final
strings in other classes isn't forcing a class initialization as it
should.
The test code below has two classes, Bar and Belle. Bar contains...
if (Belle.ASTRING.equals ("Moya"))
...do something...
This is causing a NullPointerException. Bell.ATSTRING is null
because Belle's class is never initialized. The test code also has...
System.out.println (Belle.ASTRING);
And this _works_ even without initializing Belle because it's
not actually referencing Belle.ASTRING - it's going directly to the
constant table.
This bug is preventing certain kinds of servlets from running
in Tomcat.
>How-To-Repeat:
Here are two java files and a Makefile...
begin 664 test.tar.gz
M'XL(`&>?J3L``^W636^",!@'<*[V4SSC)`=8>4\P'N9EV<$=YF[+#H55ABO@
M>#$QB]]]1=%MSLP3&I?G=X'0AT(*_[8C5A@SMF!*AZA)J><Y"I7\O6/#\EV%
M^K9KV:9/34_6FXYM*4"[?*FMNJQ8`:#$!>?9'W7'VB_4O`Y%$D$D6%G"2(X$
M^2``[54Y-)4\+/+D!5*69-"?5$62Q<"*N'QZUF1E4PTP69853XV\KHRY+*B$
M+!UQ(;AQ,WE\N+N_U09D79A,]QH,_EXS44)?'>=+IFK:NNQPCVK*JNCU2I6=
M`:S(BIQ[\/Z!S<?H=@8XEG^3>KO\F[;;Y-]W',S_*?S,?_,S')@`IDG&!+39
M;X,+0]A$=H!!O&!C]L:GB>!=/N/H^F_9N_P[IM_DW[5,S/\I,"$""$G/N`X)
M"8-F"[!>#39S@9&37AS-0,\A!%UO]@##9I/PJXJT)P%\+2B[6]LVT*/OK202
KG&4!Z14IZ%/9_[:O<P\)0@@AA!!"""&$$$(((8000@A=I$]+DV\'`"@`````
`
end
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list