JSNI 方法显然不会被编译或添加到结果 JavaScript

JSNI methods do not get compiled or added to the resulting JavaScript apparently

我以前用过 GWT,用 JSNI 没有任何问题,但现在由于某种原因在一个新项目中我有了。

在使用更复杂的设置遇到此问题后,我尝试使用这个小设置对其进行测试(从 onModuleLoad 中删除了一些与此错误完全无关的内容):

public void onModuleLoad() {
        Window.alert("number:"+getint());
    }

    public native int getint(); /*-{
        return 25;
    }-*/;

发生了完全相同的事情,这发生在我更复杂的设置中。

开发模式启动正常,但是,当我在 Chrome 中打开它时会发生这种情况:

即使方法就在那里(而且 Chromes 源助手甚至显示连接):

有人知道为什么会这样吗?

您在 getint():

之后有一个分号 (;)
public native int getint(); /*-{

不能在那里。