Hi. I just submitted a bug report on Google Code 
(https://code.google.com/p/google-web-toolkit/issues/detail?id=9155). BTW, is 
Google Code still proper place for reporting bugs? Anyways, I though to post 
here my problem as well, maybe somebody had some more experience with this 
problem.

So, I am dealing with enums. In development mode everything is working fine, 
but in compiled mode one of my enum types does not get initialized.

Here is the type in Java (this is an inner class/enum of an custom Popup):
        private enum NameSortMethod {
                ASCENDING, DESCENDING;

                private static NameSortMethod[] vals = values();

                private NameSortMethod(){
                        
                }
                
                public NameSortMethod next() {
                        // http://stackoverflow.com/a/17006263/339219
                        return vals[(this.ordinal() + 1) % vals.length];
                }

                public String getImageUri(boolean sortByStatus) {
                        if (sortByStatus) {
                                // return grey 
                                return 
TableBundle.instance.sort_grey().getSafeUri().asString();
                        } else {
                                return 
TableBundle.instance.sort_black().getSafeUri().asString();
                        }
                }
                
        }

When compiled to "DETAILED" I've found that this is its clinit:
function 
org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_$clinit__V(){
  
org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_$clinit__V
 = nullMethod;
  org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_vals = 
org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_$VALUES;
}

function 
org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_$next__Lorg_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_2Lorg_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_2(this$static){
  
org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_$clinit__V();
  return 
org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_vals[(this$static
 + 1) % 
org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_vals.length];
}

This results in TypeError when using function next. Chrome dev tools tells me 
while debugging that 
org_perfsonar_ui_client_common_component_EndpointPicker$NameSortMethod_$VALUES 
are undefined.


I have similar enum that works:
        private enum StatusSortMethod {
                // G-green (UP) R-red (DOWN) W-white (UNKNOWN & NULL STATUS)
                GRW("Available first", TableBundle.instance.sort_black()), 
                RWG("Unavailable first", 
TableBundle.instance.sort_black_rand()), 
                WGR("Unknown first", TableBundle.instance.sort_black());

                private static StatusSortMethod[] vals = values();

                private String message;
                private ImageResource 
<https://code.google.com/p/google-web-toolkit/wiki/ImageResource> sprite;

                private StatusSortMethod(String message, ImageResource 
<https://code.google.com/p/google-web-toolkit/wiki/ImageResource> 
imageResource) {
                        this.message = message;
                        this.sprite = imageResource;
                }

                public String getImageUri(boolean sortByStatus) {
                        if (sortByStatus) {
                                return sprite.getSafeUri().asString();
                        } else {
                                return 
TableBundle.instance.sort_grey().getSafeUri().asString();
                        }
                }

                public StatusSortMethod previous() {
                        return vals[(this.ordinal() + vals.length - 1) % 
vals.length];
                }
                
                public StatusSortMethod next() {
                        // http://stackoverflow.com/a/17006263/339219
                        return vals[(this.ordinal() + 1) % vals.length];
                }
        }

Its clinit is like this:
function 
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_$clinit__V(){
  
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_$clinit__V
 = nullMethod;
  org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_GRW 
= new 
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_EndpointPicker$StatusSortMethod__Ljava_lang_String_2ILjava_lang_String_2Lcom_google_gwt_resources_client_ImageResource
 <https://code.google.com/p/google-web-toolkit/wiki/ImageResource>_2V('GRW', 0, 
'Available first', 
(org_perfsonar_ui_client_resource_TableBundle_1default_1InlineClientBundleGenerator$sort_1blackInitializer_$clinit__V()
 , 
org_perfsonar_ui_client_resource_TableBundle_1default_1InlineClientBundleGenerator_sort_1black));
  org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_RWG 
= new 
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_EndpointPicker$StatusSortMethod__Ljava_lang_String_2ILjava_lang_String_2Lcom_google_gwt_resources_client_ImageResource
 <https://code.google.com/p/google-web-toolkit/wiki/ImageResource>_2V('RWG', 1, 
'Unavailable first', 
(org_perfsonar_ui_client_resource_TableBundle_1default_1InlineClientBundleGenerator$sort_1black_1randInitializer_$clinit__V()
 , 
org_perfsonar_ui_client_resource_TableBundle_1default_1InlineClientBundleGenerator_sort_1black_1rand));
  org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_WGR 
= new 
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_EndpointPicker$StatusSortMethod__Ljava_lang_String_2ILjava_lang_String_2Lcom_google_gwt_resources_client_ImageResource
 <https://code.google.com/p/google-web-toolkit/wiki/ImageResource>_2V('WGR', 2, 
'Unknown first', 
org_perfsonar_ui_client_resource_TableBundle_1default_1InlineClientBundleGenerator_sort_1black);
  
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_$VALUES
 = 
com_google_gwt_lang_Array_initValues__Ljava_lang_Class_2Lcom_google_gwt_core_client_JavaScriptObject_2ILcom_google_gwt_lang_Array_2Lcom_google_gwt_lang_Array_2(com_google_gwt_lang_ClassLiteralHolder__13Lorg_1perfsonar_1ui_1client_1common_1component_1EndpointPicker$StatusSortMethod_12_1classLit,
 makeCastMap([Q$java_io_Serializable, Q$java_lang_Object_$1]), 
Q$org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod, 
[org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_GRW, 
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_RWG, 
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_WGR]);
  org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_vals 
= 
org_perfsonar_ui_client_common_component_EndpointPicker$StatusSortMethod_$VALUES;
}

Please advise for a workaround if any?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to