Bug 26604 - Forward references unilaterally dissallowed
Summary: Forward references unilaterally dissallowed
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: Sun Solaris
: P3 major (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-18 14:04 EST by Reid Jones CLA
Modified: 2002-12-17 07:44 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.