0

With GWT I had an issue with SimpleCheckBox.wrap() method as it produced the AssertionError in DevMode. And I used to work around that by adding the code that was only being executed if GWT.isScript() is true. I face the same challenge now with SuperDevMode and the question is: is there a method of recognizing superdevmode from the source code during runtime?

Thanks in advance!

P.S. There is no quick way now of getting rid of that .wrap() call from the code so question is really limited to run mode recognition.

Upd. 1:

I created a new "special" class with no .wrap() method and added these lines into my module's gwt.xml file:

<set-property name="superdevmode" value="on"/>
<replace-with class="com.project.client.MyWidgetSuperdevmode">
    <when-type-is class="com.jostleme.jostle.ui.rich.client.MyWidgetProdMode" />
    <when-property-is name="superdevmode" value="on"/>
</replace-with>

And tried multiple things: compiled via bookmark, recompiled project old way, restarted both regular and codeserver apps; and in sourcemaps can only see class MyWidgetProdMode. What am I doing wrong? Will new classes be loaded on compile?

alexp
  • 787
  • 5
  • 26
  • If the assertion is failing, that strongly implies that you are using SimpleCheckBox.wrap incorrectly, probably by wrapping an element that isn't attached, or by trying to wrap an element that is already the child of another widget. Both of those potentially can cause memory leaks - try to avoid the assertion condition, not avoid compiling assertions. – Colin Alworth Jun 01 '14 at 22:04
  • Colin, yes it's true. There's the widget's initialization happens and the widget is not yet attached. I will take a look for how big the deal is to set the checkbox value later on attach. – alexp Jun 02 '14 at 00:34

1 Answers1

0

There's a superdevmode property that you can use in deferred binding rules, but there's otherwise no way similar to isScript() to detect whether you're in superdevmode or not. The property can have value on or off.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164