Sun JDK 1.4.2 javac compiler bug

Discussion in 'Java' started by xarax, Jul 2, 2003.

  1. xarax

    xarax Guest

    The following compiles cleanly with Sun JDK 1.4.1 javac,
    but 1.4.2 elicits an error message about the variable
    "xx" may have already been assigned:

    =================================
    public void fubar()
    {
    final int xx;
    int jj;

    jj = 0;
    while(0 != jj)
    {
    final int nn;

    nn = jj+1;
    }
    if(0 < jj)
    {
    xx = 1;
    }
    else
    {
    xx = 2;
    }
    }
    =================================

    Removing either "final" qualifier circumvents the
    problem.

    The compilers seems to be confused by the "final"
    variable within the while() loop.

    WindowsME.
     
    xarax, Jul 2, 2003
    #1
    1. Advertising

  2. xarax

    Andy Flowers Guest

    What version of the JDK are you using. I have just downloaded 1.4.2
    (1.4.2-b28) and tried this and it compiles with no error. I am using the
    WIN32 version.

    The version can be found by running 'java -version'.

    What is the exact error message you see ?

    "xarax" <> wrote in message
    news:...
    > The following compiles cleanly with Sun JDK 1.4.1 javac,
    > but 1.4.2 elicits an error message about the variable
    > "xx" may have already been assigned:
    >
    > =================================
    > public void fubar()
    > {
    > final int xx;
    > int jj;
    >
    > jj = 0;
    > while(0 != jj)
    > {
    > final int nn;
    >
    > nn = jj+1;
    > }
    > if(0 < jj)
    > {
    > xx = 1;
    > }
    > else
    > {
    > xx = 2;
    > }
    > }
    > =================================
    >
    > Removing either "final" qualifier circumvents the
    > problem.
    >
    > The compilers seems to be confused by the "final"
    > variable within the while() loop.
    >
    > WindowsME.
     
    Andy Flowers, Jul 2, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Skeet
    Replies:
    5
    Views:
    577
    xarax
    Jul 4, 2003
  2. Stefan
    Replies:
    0
    Views:
    5,015
    Stefan
    Nov 5, 2003
  3. Reinhard B.

    sun jdk-1-5-0 compiler bug

    Reinhard B., Dec 22, 2005, in forum: Java
    Replies:
    4
    Views:
    318
    Thomas Hawtin
    Dec 24, 2005
  4. Miss Michelle. Heigardt
    Replies:
    8
    Views:
    143,229
    abbinv
    Apr 9, 2011
  5. Replies:
    0
    Views:
    2,885
Loading...

Share This Page