Shikhar13 / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

On the fly compilation is not working correctly .. #302

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The issue is in IDE 
  - Eclipse, Version Juno - 20120614-1722)
  - CodenameOneFeature  1.0.0.201208091645

 protected void onGUI1_Button1Action(Component c, ActionEvent event) {
        // If the resource file changes the names of components this call will break notifying you that you should fix the code
        super.onGUI1_ButtonAction(c, event);

//this line is not accedpted by the "on the fly". compilation is working...    
        (Button)c.setText( "daniel");

//those lines are accepted...        
        Button b = (Button) c;
        b.setText( "daniel");
    }

Both cases are doing the same ...of course..

Thanks

Daniel

Original issue reported on code.google.com by dan...@gmail.com on 21 Aug 2012 at 12:31

GoogleCodeExporter commented 9 years ago
((Button)c).setText( "daniel"); is the correct syntax. The original syntax cast 
the result from set text (which is void) to Button which wouldn't compile.

Original comment by shai.almog on 21 Aug 2012 at 1:30

GoogleCodeExporter commented 9 years ago
So why the "compilation" say that is ok?
It should work the same.

Original comment by dan...@gmail.com on 21 Aug 2012 at 1:45

GoogleCodeExporter commented 9 years ago
I usually don't use Eclipse so I can't say for sure but it does have its own 
slightly incompatible compiler so that might cause issues. 

Original comment by shai.almog on 21 Aug 2012 at 6:58