找不到符号(它在那里......)

发布于 2024-10-20 16:52:19 字数 974 浏览 2 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

吃素的狼 2024-10-27 16:52:19

尝试对所有涉及的项目运行清理(在 Maven 中,假设这就是消息的来源)。

Try running a clean on all projects involved (in maven, assuming that's where the message is from).

遗弃M 2024-10-27 16:52:19

您可以尝试执行 mvn clean 然后再次构建。

You can try doing mvn clean and then building again.

羁绊已千年 2024-10-27 16:52:19

我遇到了同样的问题: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.

陌上芳菲 2024-10-27 16:52:19

我刚才遇到了这个问题。对我来说,符号位于包中,我使用 Maven 来管理代码。

只是运行:

mvn clean install

没有帮助我,然后我运行:

mvn idea:clean idea:idea

之后,我发现符号消失了,这意味着我看到的代码不是我正在使用的代码。所以我想也许是因为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:

mvn clean install

didn't help me, Then I ran:

mvn idea:clean idea:idea

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文