Bug 26604

Summary: Forward references unilaterally dissallowed
Product: [Eclipse Project] JDT Reporter: Reid Jones <reid.a.jones>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: Olivier_Thomann
Version: 2.0   
Target Milestone: 2.1 M4   
Hardware: Sun   
OS: Solaris   
Whiteboard:

Description Reid Jones CLA 2002-11-18 14:04:34 EST
Through some recent fixes in sun's j2sdk1.4.1, certain forward references of 
static variables are allowed. The following code compiles and runs using 
1.4.1's javac, but not in Eclipse 2.0:

public class Test {
  public Test(){
    super();
    System.out.println(error);
  }

  public static void main (String args[]) {
    Test test = new Test();
  }

  static {
     error = "Hello World";
  }
  private static String error;
}

I looked for this in other bug reports but could not find it.
Comment 1 Philipe Mulet CLA 2002-11-18 17:31:24 EST
No, this is definitely new. Need to check the spec.
Comment 2 Olivier Thomann CLA 2002-11-18 17:35:02 EST
Jikes 1.15 rejects it, but Jikes 1.17 accepts it.
Comment 3 Philipe Mulet CLA 2002-11-20 06:35:59 EST
Olivier - can you please look for a URL to this bug in javac database ?
Comment 4 Olivier Thomann CLA 2002-11-26 13:09:24 EST
This is a link pointing to this problem.
http://developer.java.sun.com/developer/bugParade/bugs/4459133.html

If the reference is an assignement, then it should not complain about an invalid
forward reference. See latest specs:
http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#287406

Jacks test suite has some related tests.
Comment 5 Olivier Thomann CLA 2002-11-27 09:30:37 EST
Add CC
Comment 6 Philipe Mulet CLA 2002-12-02 17:50:31 EST
Indeed the spec is pretty clear, assignments should be allowed to perform on 
forward references.
Comment 7 Philipe Mulet CLA 2002-12-04 06:15:21 EST
Assignments will no longer complain about forward references.
Fixed.
Comment 8 David Audel CLA 2002-12-17 07:44:17 EST
Verified.