Albrecht Kleine wrote:
> 
> FYI: jikes 0.36 (announced here on this list some weeks ago)
>      cannot compile next t.java file:
> 
> ----------------------------------------------------------
> import java.awt.*;
> import java.awt.event.*;
> class t
> {
>     public t()
>     {
>       int e = 0;
>       Button b = new Button();
>       b.addActionListener(new ActionListener()
>        {
>         public void actionPerformed(ActionEvent e)
>          {
>            System.out.println("actionPerformed:"+e);
>          }
>       });
>       System.out.println("constructor:"+e);
>     }
> }
> -----------------------------------------------------------
> 
> Note: neither javac nor guavac1.0 (GNU) have any problems
> to compile this.
> 
> Any comments ?

This is what I got:

-----------------------------
slackguy$ jikes breaksjikes.java 

Found 1 semantic error compiling "breaksjikes.java":

    11.         public void actionPerformed(ActionEvent e) 
                                                        ^
*** Error: Duplicate declaration of local variable e
--------------------------------

It doesn't like the variable overriding the one in the containing
class. Jikes is a lot pickier than javac; whether this is a better
interpretation of the language spec I'll leave to the language lawyers.
Jikes' interpretation definitely would stop a whole class of
hard-to-diagnose bugs, but would be a bit limiting as well. <shrug>

I have witnessed a more disturbing problem with jikes that I haven't
been able to duplicate with a small piece of code. I have some GUIs with
multiple function buttons - kind of like the various drawing buttons in
an art application. Each are valid under certain circumstances and with
certain things selected, therefore there is a fair amount of
disabling/enabling involved, and a good bit of event passing. If I
compile with javac, it works fine; with jikes things get disabled and
are never enabled. My guesses so far:

1) Jikes has different default initialization behavior
2) Jikes generates different bytecodes, which aggravates a race
condition

I hope to hunt it down soon; I really like jikes' speed and
functionality, and don't mind its anal retentiveness. But in the
meantime I'm cranking out bells and whistles...

-- 

Paul Reavis                                      [EMAIL PROTECTED]
Design Lead
Partner Software, Inc.                        http://www.partnersoft.com

Reply via email to