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. Advertisements

  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. Advertisements

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:
    750
    xarax
    Jul 4, 2003
  2. Stefan
    Replies:
    0
    Views:
    5,320
    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:
    376
    Thomas Hawtin
    Dec 24, 2005
  4. Miss Michelle. Heigardt
    Replies:
    8
    Views:
    146,280
    abbinv
    Apr 9, 2011
  5. Dean Schulze
    Replies:
    7
    Views:
    9,544
    Thomas Hawtin
    Feb 28, 2006
  6. Replies:
    0
    Views:
    3,139
  7. Frank Fredstone

    jdk 1.4.2 javac and java.endorsed dirs

    Frank Fredstone, Jun 22, 2006, in forum: Java
    Replies:
    0
    Views:
    1,529
    Frank Fredstone
    Jun 22, 2006
  8. Marc van Dongen

    Compiler Bug?? (javac 1.6.0_0-internal)

    Marc van Dongen, Dec 21, 2008, in forum: Java
    Replies:
    12
    Views:
    1,205
    Andrew Thompson
    Dec 28, 2008
Loading...