Mryqu's Notes


  • 首页

  • 搜索
close

[Eclipse] Find the override method implementation in subclasses

时间: 2013-10-26   |   分类: Tool   Eclipse     |   阅读: 34 字 ~1分钟

已知当前对象为org.apache.hadoop.hdfs.client.HdfsDataInputStream实例,调用其祖宗抽象类java.io.InputStream的publicint read(byte b[], int off, int len) throwsIOException方法,究竟最后使用的是那个类的实现呢? [Eclipse] Find the override method implementation in subclasses 由如上类继承图可知,应该从对象类往上依次查找方法实现:HdfsDataInputStream、FSDataInputStream、……。工作很繁琐,挑战眼力!

一个快捷的方式就是进入java.io.InputStream类,选中read(byte b[], int off, intlen) 方法,按住CTRL键后点击鼠标左键,这样会出现一个菜单: [Eclipse] Find the override method implementation in subclasses 选择OpenImplementation菜单,输入HdfsDataInputStream、FSDataInputStream、……,可以更轻松的找到重写该方法的子类。 [Eclipse] Find the override method implementation in subclasses 最终可知使用的是java.io.DataInputStream类中的实现:

public final int read(byte b[], int off, int len) throws IOException {
  return in.read(b, off, len);
}

标题:[Eclipse] Find the override method implementation in subclasses
作者:mryqu
声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!

#eclipse# #override# #method# #implementation# #subclass#
[C++] 重温函数隐藏和重写
学习十二要素应用宣言
  • 文章目录
  • 站点概览

Programmer & Architect

662 日志
27 分类
1472 标签
GitHub Twitter FB Page
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%