The compiler indeed will do an admirable job of removing dead code. But since you're seeing runtime errors in the mobile version, I'd say it's very likely that you have "live" references to the maps code somewhere, possibly in the parsers you mentioned. Refactoring will help you eliminate those references or isolate them so that your mobile version only gets the code it needs, making it smaller and faster (both especially important for mobile apps, as I'm sure you are already aware).
It's possible that your regular version's entry point references maps code. As I understand it, both of the entry points defined in the Module_A and Module_B will be executed when Module_B loads since B inherits A's entry point. Refactoring so that A and B inherit from a common base (without an entry point) will solve that. On Thu, Mar 12, 2009 at 12:56 PM, Pavel Byles <[email protected]> wrote: > Well it's not hard to refactor, but I was hoping that the GWT compiler would > figure out what I need and don't need. But I do see why this would be > better. > > The thing is that I am making a mobile version of my application and I don't > want to include google maps on my mobile version. I also have my JSON data > parsers in my original application and some reference the google maps api. > > On Thu, Mar 12, 2009 at 11:39 AM, Isaac Truett <[email protected]> wrote: >> >> Sorry to disappoint. >> >> I'm actually curious why you don't want to refactor. I find that >> sorting through dependencies in this way usually results in better >> code. >> >> >> On Thu, Mar 12, 2009 at 12:35 PM, Pavel Byles <[email protected]> >> wrote: >> > I was hoping I wouldn't have to do this >> > Thanks Isaac. >> > >> > On Thu, Mar 12, 2009 at 11:32 AM, Isaac Truett <[email protected]> >> > wrote: >> >> >> >> Pavel, >> >> >> >> No, you can't exclude part of an inherited module. What you can do is >> >> refactor your modules so that you aren't inheriting bits you don't >> >> want: >> >> >> >> 1. Create a module for the bits of Module_A that don't require the >> >> maps API. Let's call it Module_A_WM (Without Maps). >> >> 2. Have Module_B inherit Module_A_WM. >> >> 3. Have Module_A inherit Module_A_WM and the maps API. >> >> >> >> Obviously you'll want a more meaningful name for the new Module_A_WM. >> >> >> >> - Isaac >> >> >> >> >> >> On Thu, Mar 12, 2009 at 11:57 AM, Pavel Byles <[email protected]> >> >> wrote: >> >> > I have a module ("Module_A") that inherits and requires the >> >> > gwt_google_maps_api and another ("Module_B") that inherits from >> >> > Module_A. >> >> > But Module_B doesn't need to use the gwt_google_maps_api. >> >> > Everything compiles and deploys just fine, but when running the web >> >> > application (Module_B) there is a javascript error that says that the >> >> > maps >> >> > api key is missing: "uncaught exception: java.lang.RuntimeException: >> >> > The >> >> > Maps API has not been loaded. Is a <script> tag missing from your >> >> > host >> >> > HTML >> >> > or module file? Is the Maps key missing or invalid?" >> >> > Is there a way to exclude some inherited modules? >> >> > Module_A.gwt.xml: >> >> > <module> >> >> > <!-- Inherit the core Web Toolkit stuff. --> >> >> > <inherits name="com.google.gwt.user.User"/> >> >> > <inherits name="com.google.gwt.xml.XML"/> >> >> > <inherits name="com.google.gwt.http.HTTP"/> >> >> > <inherits name="com.google.gwt.json.JSON"/> >> >> > <inherits name="com.google.gwt.i18n.I18N"/> >> >> > >> >> > <!-- Inherit Custom Widgets --> >> >> > <inherits name="com.google.gwt.maps.GoogleMaps"/> >> >> > >> >> > <!-- Spanish default --> >> >> > <extend-property name="locale" values="es"/> >> >> > >> >> > <!-- Specify the app entry point class. --> >> >> > <entry-point class='com.pavco.client.Index'/> >> >> > >> >> > <inherits name="com.google.gwt.user.theme.standard.Standard"/> >> >> > >> >> > <set-property name="user.agent" value="gecko"/> >> >> > </module> >> >> > >> >> > >> >> > Module_B.gwt.xml: >> >> > <module> >> >> > <!-- Inherit the core Web Toolkit stuff. --> >> >> > <inherits name='com.google.gwt.user.User'/> >> >> > <inherits name="com.google.gwt.xml.XML"/> >> >> > <inherits name="com.google.gwt.http.HTTP"/> >> >> > <inherits name="com.google.gwt.json.JSON"/> >> >> > <inherits name="com.google.gwt.i18n.I18N"/> >> >> > >> >> > <inherits name="com.pavco.Index"/> >> >> > >> >> > <!-- Specify the app entry point class. --> >> >> > <entry-point class='com.pavco.mobile.client.M_Index'/> >> >> > >> >> > <stylesheet src='css/m_index.css' /> >> >> > >> >> > <inherits name="com.google.gwt.user.theme.standard.Standard"/> >> >> > <!-- <inherits name="com.google.gwt.user.theme.chrome.Chrome"/> >> >> > --> >> >> > <!-- <inherits name="com.google.gwt.user.theme.dark.Dark"/> --> >> >> > </module> >> >> > >> >> > -- >> >> > -Pav >> >> > >> >> > > >> >> > >> >> >> >> >> > >> > >> > >> > -- >> > -Pav >> > >> > > >> > >> >> > > > > -- > -Pav > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
