[gwt-2.5-rc1] Cannot reference a field before it is defined

146 views
Skip to first unread message

Strelok

unread,
Jul 22, 2012, 2:17:40 AM7/22/12
to google-we...@googlegroups.com
Strange problem after upgrading to 2.5RC1.

We have serveral enums with private static final const strings inside them and on compilation (both DevMode and web mode) I receive the "Cannot reference a field before it is defined" error. Inlining the const variables seems to solve the issue. Anybody else experience something like that? Wonder if I should file a bug or I am doing something wrong?

Cheers!

Patrick Tucker

unread,
Jul 22, 2012, 10:10:25 PM7/22/12
to google-we...@googlegroups.com
Code sample?

Erez

unread,
Nov 15, 2012, 11:26:19 AM11/15/12
to google-we...@googlegroups.com
public enum LogLevel implements Serializable {
  FATAL(LogLevel.FATAL_INT), ERROR(LogLevel.ERROR_INT), WARN(LogLevel.WARN_INT), INFO(LogLevel.INFO_INT), DEBUG(
          LogLevel.DEBUG_INT);

  public static final int FATAL_INT = 32;
  public static final int ERROR_INT = 16;
  public static final int WARN_INT = 8;
  public static final int INFO_INT = 4;
  public static final int DEBUG_INT = 2;

  LogLevel() {
    priority = -1;
  }

  LogLevel(int priority) {
    this.priority = priority;
  }

  public int getPriority() {
    return priority;
  }

  private final int priority;
}


Gives the following error:
         Checking rule <generate-with class='com.allen_sauer.gwt.log.rebind.LogMessageFormatterGenerator'/>
            [ERROR] Errors in 'file:/.../LogLevel.java'
               [ERROR] Line 11: Cannot reference a field before it is defined
               [ERROR] Line 11: Cannot reference a field before it is defined
               [ERROR] Line 11: Cannot reference a field before it is defined
               [ERROR] Line 11: Cannot reference a field before it is defined
               [ERROR] Line 11: Cannot reference a field before it is defined


On Sunday, July 22, 2012 10:10:25 PM UTC-4, Patrick Tucker wrote:
Code sample?
Reply all
Reply to author
Forward
0 new messages