【发布时间】:2014-11-07 22:24:28
【问题描述】:
我有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 中。
不过,该课程是我的代码的一部分。是的,我知道这是一个 hack。
编译此代码会导致此错误:
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 的包的一部分。真的吗?有什么解决方法吗?
谢谢!
【问题讨论】: