Hi all,

I was having a closer look and noticed (I am using gwt 1.5.2 still)
that a variable and field that isn't used, isn't removed by the
compiler if it has the class name as value.

I did a little test with the following code.
The example  class "LabelWidgetFactoryCms" contains the following
fields and method:
----
        private final Logger F_TEST1 =  FactoryLogger.getLogger(this.getClass
().getName() + "TEST1");
        private final Logger F_TEST2 =  FactoryLogger.getLogger("TEST2");
        private final String F_TEST3 =  "TEST3";
        private final Logger F_TEST4 = new Logger(this.getClass().getName() +
"TEST4");
        private final Logger F_TEST5 = new Logger("TEST5");
        private final String F_TEST6 = this.getClass().getName() + "TEST6";
        private final String F_TEST7 = LabelWidgetFactoryCms.class.getName()
+ "TEST";


        public Widget createTextWidget(final String key) {
                Logger L_TEST1 =  
FactoryLogger.getLogger(this.getClass().getName()
+ "TEST1");
                Logger L_TEST2 =  FactoryLogger.getLogger("TEST2");
                String L_TEST3 =  "TEST3";
                Logger L_TEST4 = new Logger(this.getClass().getName() + 
"TEST4");
                Logger L_TEST5 = new Logger("TEST5");
                String F_TEST6 = this.getClass().getName() + "TEST6";
                String F_TEST7 = LabelWidgetFactoryCms.class.getName() + 
"TEST7";
                return createLabelWidget(findContentItem(key));
        }
----
Note:
- FactoryLogger.getLogger(String) simple returns null.
- Neither the fields or the variables aren't used.


The result of compiler with mode PRETTY is the following:
----
function $LabelWidgetFactoryCms_0(this$static, formatter,
toolTipProvider){
  getLogger(this$static.getClass$().typeName + 'TEST1');
  this$static.getClass$().typeName + 'TEST4';
  this$static.getClass$().typeName + 'TEST6';
  return this$static;
}

...
function $createTextWidget(this$static, key){
  getLogger(this$static.getClass$().typeName + 'TEST1');
  this$static.getClass$().typeName + 'TEST4';
  this$static.getClass$().typeName + 'TEST6';
  return this$static.createLabelWidget($findContentItem_0(this$static,
key));
}
...
----

Conclusion:
- An unused field isn't removed when it includes the "this" class
name.
- An unused variable isn't removed when it included the "this" class
name.

Hmmmm interesting.... especially the difference getClass().getName()
and LabelWidgetFactoryCms.class.getName()
Is this a bug or expected behavior?


-- Ed


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to