无法重构/删除方法

发布于 2024-12-20 01:36:16 字数 317 浏览 4 评论 0原文

希望这应该是一个简单的问题。 :)

我正在使用 Pharo / Seaside。我使用 IDE 中的重构功能来重命名和删除一些方法和类。到目前为止,一切都很好。

但是,我很难删除覆盖父类的方法。例如,我有一个类“MyClass”,它是“WAComponent”的子类。我创建了一个方法“样式”来重写父类中的方法。

我决定我真的不需要重写“样式”,并且想要重构方法>删除“样式”。此时我收到以下提示“可能调用 WAPresenter 中的样式。浏览参考文献?”

我该如何继续?我只想要超级的“风格”方法,而不是我自己的覆盖。

非常感谢!

This should hopefully be a simple question. :)

I'm using Pharo / Seaside. I have used the refactoring capability in the IDE to rename and remove a few of my methods and classes. So far so good.

However, I'm having difficulty removing a method that overrides the parent class. For example, I have a class "MyClass" that subclasses "WAComponent". I created a method "style" that overrides a method in the parent class.

I decided I don't really need to override "style" after all and want to Refactor method > Remove "style". At this point I receive the following prompt "Possible call to style in WAPresenter. Browse references?"

How do I proceed? I just want the super's "style" method and not my own override.

Many thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

未央 2024-12-27 01:36:16

当你尝试删除一个方法时;使用重构浏览器、OmniBrowser 或标准浏览器;如果图像中存在该消息的发件人,系统会向您发出警告。这使您有机会了解删除可能产生的后果。它并不完美,因为a)在动态系统中,无法确定接收者是否是您的类的实例,并且b)它无法使用#perform捕获发送者:

在您的情况下,消息确实看起来有点令人困惑。另外,在 Pharo 1.3 中,无论您选择什么,似乎都不会删除该方法!但是直接通过浏览器(Mac 上 OmniBrowser 中的 Cmd-x 或通过菜单)删除它并没有什么坏处,因为对此方法的任何调用都将转到超类。

When you try to remove a method; either with the refactoring browser, OmniBrowser, or the standard Browser; the system warns you if there are senders of that message in the image. This gives you an opportunity to see the possible ramifications of the removal. It's not perfect because a) in a dynamic system, it can't be sure if the receiver is an instance of your class, and b) it doesn't catch senders using #perform:

In your case, the message does seem a little confusing. Also, in Pharo 1.3, it seems not to remove the method no matter what you select! But there is no harm in just removing it directly via your browser (Cmd-x in OmniBrowser on Mac or via the menu) because any calls to this method will go to the superclass.

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