GWT是否支持外部jar包中的类



我有这个类:

package com.badlogic.gdx.physics.box2d;
/** placed in this package to have access to the protected {@code addr} fields */
public class Box2DUtils {
    /** @return {@link Body#addr} */
    public static long getAddr(Body body) {
        return body.addr;
    }
    // more methods...
}

com.badlogic.gdx.physics.box2d位于依赖关系jar中。这个类是我代码的一部分。是的,我意识到这是一个黑客。

编译此代码会导致以下错误:

Compiling module com.mygdx.game.GdxDefinition
   Validating units:
      [ERROR] Errors in 'jar:file:/home/dermetfan/.gradle/caches/modules-2/files-2.1/net.dermetfan.libgdx-utils/libgdx-utils-box2d/0.7.2/c4b052017a597e18b40c0dd7e42eff400d2f0731/libgdx-utils-box2d-0.7.2-sources.jar!/com/badlogic/gdx/physics/box2d/Box2DUtils.java'
         [ERROR] Line 24: addr cannot be resolved or is not a field
         [ERROR] Line 29: addr cannot be resolved or is not a field
         [ERROR] Line 34: addr cannot be resolved or is not a field
   [ERROR] Aborting compile due to errors in some input files

我怀疑GWT有问题,因为我的类是外部jar包的一部分。这是真的吗?有解决办法吗?

谢谢!

是的,GWT支持外部jar包中的类。

然而,如果这是将运行客户端的代码,即正在转换为javascript的代码,那么您也需要源代码。

最新更新