[kaffe] KJC bug preventing Ant 1.6.0 bootstrap

Guilhem Lavaux guilhem@kaffe.org
Sat Jan 3 10:05:02 2004


Dalibor Topic wrote:

> Hi Ito, salut Guilhem,
>
> I've tried to update kaffe-extras to 1.1.3 and ant 1.6.0, and after 
> spending some time revisiting the ant bootstrap script, I failed due 
> to what seems to be a compiler bug in kjc. 

I fear the problem is deeper than I thought. It lies in the automatic 
type conversion during an assignment for static initializers only. The 
reason is that during the semantic analysis of the expression 'b' (in 
'a=b') throwables are initialized but the representative of the 
expression 'b' is remplaced by a pseudo expression. For static 
initializers there are two passes. As 'b' has been replaced the 
throwables are not set anymore and the 'try { } catch' block doesn't 
enclose anymore a valid block. I see for the moment only two solutions: 
we should detect the throwables added by the first analysis and add them 
again during the second analysis in the replacing expression or use only 
one pass. I'll try to dig into these two options for the moment.

If someone has a better idea feel free to experiment. ;-)

Cheers,
Guilhem.

P.S.: A way to disable the problem is to separate the type casting from 
the assignment, i.e. (with B inheriting from A):

{
  B b;

  try
  {
    A a = new A();
    b = a;
  }
  catch(...)
}