This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: critical Java regression
- From: Mark Wielaard <mark at klomp dot org>
- To: Per Bothner <per at bothner dot com>
- Cc: java at gcc dot gnu dot org
- Date: 23 Apr 2002 01:26:31 +0200
- Subject: Re: critical Java regression
- References: <3CC478DD.7040605@bothner.com>
Hi,
On Mon, 2002-04-22 at 22:55, Per Bothner wrote:
> When I do (cd gnu/math; make) given the attached sources,
> I get the following:
>
> CLASSPATH=.:../.. gcj -C RealNum.java
> gcj -g -I../.. -I. -c FixedRealFormat.java -o gnu-math.o
> gnu/math/RealNum.java: In class `gnu.math.FixedRealFormat':
> gnu/math/RealNum.java: In method
> `gnu.math.FixedRealFormat.format(gnu.math.RatNum,java.lang.StringBuffer)':
> gnu/math/RealNum.java:0: reading class gnu.math.RealNum for the second
> time from ./RealNum.class
> compilation terminated.
>
> This case is simplified from Kawa. It used to work last time
> I tried this. I consider this a release-critical regression.
>
> The problem happens when trying to resolve RealNum.toScaledInt.
> It first looks for a class 'RealNum.toScaledInt' and then looks
> for 'RealNum'. However, the latter does not check if the class
> is already loaded. Unfortunatey, I don't know this code well
> enough to know should be happening.
Ugh, nasty. The reason it fails to see that the class is already loaded
is because the first time it loads ../../gnu/math/RealNum.class, but the
second time it loads RealNum.class from the current directory.
The first time it tries to read RealNum is when it resolves the RatNum
which has as superclass RealNum. The second time it tries to resolve
RealNum.toScaledInt, which makes it look for the class RealNum which
thinks to finds in the no-name package.
A quick workaround seems to be to just ignore this and only issue a
warning when coming across a second class file that defines the same
class.
Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.104.2.7
diff -u -r1.104.2.7 jcf-parse.c
--- jcf-parse.c 22 Apr 2002 20:36:47 -0000 1.104.2.7
+++ jcf-parse.c 22 Apr 2002 23:25:00 -0000
@@ -680,9 +680,10 @@
if (CLASS_PARSED_P (current_class))
{
/* FIXME - where was first time */
- fatal_error ("reading class %s for the second time from %s",
+ warning ("reading class %s for the second time from %s",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))),
jcf->filename);
+ return;
}
CLASS_PARSED_P (current_class) = 1;
Ugly, but it was the only thing I could come up with quickly.
Cheers,
Mark