Good question, does final act as an inline keyword ? That would be awesome .
On Thu, Nov 5, 2009 at 10:36 AM, Davis Ford <[email protected]> wrote: > Ok, I can see that for string constants, but what about other scenarios? > classes? > public final class SomeClass { } vs. public class SomeClass { } > object references? > public void doSomething( ) { > final ArrayList<String> list = new ArrayList<String>(); > } > vs. > public void doSomething( ) { > ArrayList<String> list = new ArrayList<String>(); > } > method args? similar to above: > public void doSomething(final ArrayList<String> list) {} vs. public void > doSomething(ArrayList<String> list) {} > methods? > public final void doSomething( ) {} vs. public void doSomething( ) {} > Regards, > Davis > > On Thu, Nov 5, 2009 at 12:52 PM, Sripathi Krishnan > <[email protected]> wrote: >> >> Yes. >> If you have something like this - public static final String HELLO = >> "Hello"; >> GWTC will get rid of the field in the compiled js, and just inline (i.e. >> "hard-code" ) the value everywhere it is used. >> --Sri >> >> >> 2009/11/5 Davis Ford <[email protected]> >>> >>> Aside from just declaring intent that a field's value isn't supposed to >>> change and generating a compiler error if you assign a new value, some JDKs >>> are known to optimize the bytecode when fields are final. >>> I'm wondering if there is any such value in the translation from Java to >>> JavaScript (i.e. does it translate to const in JS)? >>> Regards, >>> Davis >>> >> >> >> > > > > -- > Zeno Consulting, Inc. > home: http://www.zenoconsulting.biz > blog: http://zenoconsulting.wikidot.com > p: 248.894.4922 > f: 313.884.2977 > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
