我有this课程:
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包的一部分。真的吗?任何解决方法?
谢谢!
答案 0 :(得分:2)
是的,GWT支持外部jar包中的类。
但是,如果这是运行客户端的代码,即正在转换为javascript的代码,那么您也需要源代码。