I think it is a good idea to get rid of methods which always return
true/false/true because it saves a lot of code in the final js, and it
gives the option to the developer to remove code programatically.

In my opinion the example you show and the examples in the issue page are
not examples of good codding, but maybe there are edge cases where it could
make sense.

I trust in the compiler and I have several projects in production and never
I faced this problem, so IMHO knowing a couple of good practices to follow
with gwt  should be enough.

Anyway, in the case it were difficult to fix, I think the compiler should
be more verbose and fail with methods which have any line apart from the
return true one,

- Manolo


On Fri, Sep 28, 2012 at 2:24 PM, Marc2000 <whipma...@googlemail.com> wrote:

> Hallo,
>
> After finishing development on my GWT (2.4) project, I found out, that the
> compiled version does not work exactly as in the development mode.
>
> Some method ( isValid() ) seems not to be called.
>
> Calling code (simplified):
>
> boolean valid=true;
> if(! mypanel.isValid())
>    valid=false;
>
> method:
>
> public boolean isValid()
> {
>     updateSomeData();
>     return true;
> }
>
> This works well in development mode, but in compiled code, isValid() was
> never called. From this point things got strange. I've added a log-command
> to the method:
>
> public boolean isValid()
> {
>     updateSomeData();
>     logger.info("method called");
>     return true;
> }
>
> The method was called and the log entry written.
>
> I removed the log entry and changed the calling part to:
>
> boolean valid=true;
> boolean x=mypanel.isValid();
> if(!x)
>    valid=false;
>
> Now again the method was called. This seems to be some problem in the
> compiler optimizer. After switching off the optimizer, the compiled code
> did work as expected.
>
> After searching the web, I found an issue report, DESCRIBING THE EXACT
> SAME PROBLEM !
>
> See: http://code.google.com/p/google-web-toolkit/issues/detail?id=6551
>
> So this is a know issue since over a year and present since GWT 2.3 !!!
>
> I have not problem with bugs, but I can't understand, why no one seems to
> care. Can there be something more serious, than a compiler-bug ?
>
> If you search the database, there are some compiler / optimizer issues,
> that seem not to have been fixed.
>
> Example:
>
> http://code.google.com/p/google-web-toolkit/issues/detail?id=5739
>
> This is scary ! If you can't trust the compiler, you'll never know, if
> your code works in production as I did under development. Adding / removing
> a single line may change the whole behavior. Testing will become a
> nightmare !
>
> Some one should care.
>
> regards
>
> Marc
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/K3Zt9B3sxW8J.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

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

Reply via email to