Native method compilation problem

15 views
Skip to first unread message

Christophe

unread,
Sep 21, 2011, 9:00:06 AM9/21/11
to Google Web Toolkit
Hi,

I have a compilation problem with a 'javascript' native methid, but I
can not find the problem. Can someone help ?

public native void defineJS() /*-{
var that = this;
$wnd.modifyTabTitle = function(title) {

$entry(th...@fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.PnlShowDocument::__modifyTabTitle(Ljava/
lang/String;)(title));
};
}-*/;


Thanks a lot in davance,
Christophe

Thomas Broyer

unread,
Sep 21, 2011, 9:47:46 AM9/21/11
to google-we...@googlegroups.com


On Wednesday, September 21, 2011 3:00:06 PM UTC+2, Christophe wrote:
Hi,

I have a compilation problem with a 'javascript' native methid, but I
can not find the problem.

If it doesn't compile, there must be an error message. They're generally useful for debugging.
 
Can someone help ?

    public native void defineJS() /*-{
        var that = this;
        $wnd.modifyTabTitle = function(title) {
 
$entry(th...@fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.PnlShowDocument::__modifyTabTitle(Ljava/
lang/String;)(title));
        };
     }-*/;

Don't know what the issue is, but there are two issues here, a syntax one, and a bug:
  1. there should be a "." between "that" and "@fr.gouv.finances.…": that.@fr.gouv.finances.…
  2. the $entry() is not correctly used: $entry() wraps a function so that calling the returned function executes the scheduledEntry and scheduledFinally commands, and route exceptions through the GWT.UncaughtExceptionHandler; but here you're wrapping the return value of your method, after calling it, and you don't use the return value of $entry(); so it's useless.
    Best is to wrap your anonymous function with $entry: $wnd.modifyTabTitle = $entry(function(title) { ... });
 
Reply all
Reply to author
Forward
0 new messages