facebook

"Cannot reference a field before it is defined"

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #299714 Reply

    przemelek
    Member

    MyEclipse 7.5 reports error “Cannot reference a field before it is defined” for 2nd line of this code.

    
    public enum T {
        A(T.CONST);
        static final String CONST = "T";    
        private T(String str) {
        }
    }
    

    Eclipse 3.5 RC4, and MyEclipse 7.1.1 likes this code, and doesn’t complain.

    Any suggestions? 🙂

    #299738 Reply

    Loyal Water
    Member

    Can you go to MyEclipse > Installation Summary > Installation Details and paste the information here for me.

    In 7.1 you will get a warning saying “Cannot Resolve T.CONST”.

    Can you send me some screenshots pointing out the issue that you reported or give me some more details on how to reproduce it. I was unable to reproduce it at my end.

    #299739 Reply

    przemelek
    Member

    Base on answer which I got on Twitter, it isn’t problem caused by MyEclipse, but by Eclipse 3.4.2 https://bugs.eclipse.org/bugs/show_bug.cgi?id=269388
    And in “bundled” version of MyEclipse 7.5 you are using Eclipse 3.4.2.

    #299741 Reply

    Scott Anderson
    Participant

    Very interesting… reading the bug report at Eclipse it seems like this error reporting is actually correct, as per the JLS. It’s likely that Eclipse 3.4.1 wasn’t as rigorous about compliance and 3.4.2 actually is a more conforming implementation. I learn something new every day. 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: "Cannot reference a field before it is defined"

You must be logged in to post in the forum log in