找不到符号(它在那里......)
我在 netbeans 的 Maven 项目中有以下行。
Projection projection = two.translate(Vector.reg1).projection(direction);
二是一个 Shape 实例。
public abstract class Shape {
public double mass;
public double momentOfIntertia;
public Vector center;
public abstract List<Edge> normals(Vector direction);
public abstract Projection projection(Vector line);
public abstract Shape transform(Transformation transformation);
public abstract Shape translate(Vector translation);
public abstract void render(Graphics graphics);
}
当我编译时出现此错误。
[ERROR]BUILD FAILURE
------------------------------------------------------------------------
Compilation failure
org/curious/pounce/Collision.java:[89,39] cannot find symbol
symbol : method translate(org.curious.pounce.math.Vector)
location: class org.curious.pounce.Shape
我不确定这会出现什么问题,如果有任何问题,netbeans 应该在 IDE 中指出错误,但事实并非如此。
I have the following line in a maven project in netbeans.
Projection projection = two.translate(Vector.reg1).projection(direction);
two is a Shape instance.
public abstract class Shape {
public double mass;
public double momentOfIntertia;
public Vector center;
public abstract List<Edge> normals(Vector direction);
public abstract Projection projection(Vector line);
public abstract Shape transform(Transformation transformation);
public abstract Shape translate(Vector translation);
public abstract void render(Graphics graphics);
}
and when I compile I get this error.
[ERROR]BUILD FAILURE
------------------------------------------------------------------------
Compilation failure
org/curious/pounce/Collision.java:[89,39] cannot find symbol
symbol : method translate(org.curious.pounce.math.Vector)
location: class org.curious.pounce.Shape
I'm not sure what can be wrong with this, if anything was wrong netbeans should be pointing out the error in the IDE, which it isn't.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
尝试对所有涉及的项目运行清理(在 Maven 中,假设这就是消息的来源)。
Try running a clean on all projects involved (in maven, assuming that's where the message is from).
您可以尝试执行
mvn clean
然后再次构建。You can try doing
mvn clean
and then building again.我遇到了同样的问题:Netbeans 指示无效方法,但他在那里!我尝试了多种方法来解决这个问题但没有成功。因此,我手动将 jar 存档上传到项目的依赖项中:右键单击依赖项,右键单击 jar 存档,手动安装工件。
I had the same problem: Netbeans indicates a invalid method but he was there! I tried several ways to resolve this issue without success. So, i upload manually the jar archive into dependence of project: right-click on dependency, right-click on jar-archive, install artifact manually.
我刚才遇到了这个问题。对我来说,符号位于包中,我使用 Maven 来管理代码。
只是运行:
没有帮助我,然后我运行:
之后,我发现符号消失了,这意味着我看到的代码不是我正在使用的代码。所以我想也许是因为IntelliJ没有更新代码,才导致了这种混乱。
I had this problem just now. For me, the symbol is in a package, and I'm using maven to manage the code.
Just running:
didn't help me, Then I ran:
After this, I found the symbol disappeared, which means the code I saw is not the code I was using. So I think maybe it is because the IntelliJ didn't update the code, which leads to this confusion.