Speculating a bit above my expertise level here, but it appears there is a window in the
class initialization that could explain this. Here's part of the initializer for my Session.Mode enum
Reading this, Session_Mode.initialized is set to TRUE, and then online_shared_Session_Mode___CLINIT____
is called. online_shared_Session_Mode___CLINIT____ is where the enum .values array is initialized.
void __STATIC_INITIALIZER_online_shared_Session_Mode(CODENAME_ONE_THREAD_STATE) {
if(class__online_shared_Session_Mode.initialized) return;
class_array1__online_shared_Session_Mode.vtable = initVtableForInterface();
monitorEnter(threadStateData, (JAVA_OBJECT)&class__online_shared_Session_Mode);
if(class__online_shared_Session_Mode.initialized) {
monitorExit(threadStateData, (JAVA_OBJECT)&class__online_shared_Session_Mode);
return;
}
class__online_shared_Session_Mode.vtable = malloc(sizeof(void*) *20);
__INIT_VTABLE_online_shared_Session_Mode(threadStateData, class__online_shared_Session_Mode.vtable);
class__online_shared_Session_Mode.initialized = JAVA_TRUE;
monitorExit(threadStateData, (JAVA_OBJECT)&class__online_shared_Session_Mode);
online_shared_Session_Mode___CLINIT____(threadStateData);
}
Here's the enum definition
static enum Mode
{
Game(true,"","Game Room","Anyone can play in this room"),
Chat(false,"x","Chat Room",""),
Review(false,"x","Review Games","replay or review saved games"),
Map(false,"x","Map of Player Locations",""),
Doubles(true,"D!","Doubles Room","Teams of two players can play"),
Master(true,"M!","Master Room", "Master ranked players can play"),
Challenge(true,"C!","Challenge Room","The Beat-the-Robot challenge"),
Unranked(true,"U!","Unranked Room","Games do not affect your Ranking"),
Table(true,"T!","Table Mode Room","Like playing with real tiles"),
Cafe(true,"C!","Cafe Room","Games with win/loss scoring and doubling");
static Mode order[] = {Mode.Game,Mode.Cafe,Mode.Doubles,Mode.Master,Mode.Challenge,Mode.Review,Mode.Chat,Mode.Map,Mode.Unranked,Mode.Table};
static Mode[] getMenuOrder() { return(order); }
String prefix;
String name;
String subhead;
boolean isAGameMode;
String getName() { return(name); }
String getPrefix() { return(prefix); }
String getSubhead() { return(subhead); }
Mode(boolean g,String p,String n,String s)
{ isAGameMode = g;
prefix = p;
name = n;
subhead = s;
}
boolean isAgameMode() { return(isAGameMode); }
static Mode getMode (int m) { for(Mode v : values()) { if(v.ordinal()==m) { return(v); }} ; return(null); }
int getValue() { return(ordinal()); }
}