HBase源代码调试(1)

来源:互联网 发布:软件测试转正心得体会 编辑:程序博客网 时间:2024/04/30 12:24

搭好环境,终于可以开始调试跟踪代码了.

第一个问题:

VersionInfo.java里面

  public static String getVersion() {
    return version != null ? version.version() : "Unknown";
  }

之类的函数, version总是null, 导致版本不匹配,没怎么走几步就退出了


原来是Annotaion的问题, 解决办法就是在和VersionAnnotation类同级的目录下,

加一个package-info.java的java文件, 

定义好VersionAnnotation里面定义的几个String对象

(不能偷懒少定义某一个, 会runtime error的),内容参见前一篇blog

----------------------------------------------------------------------------------------

Eclipse access restriction:Class is not accessible 
"Access restriction: Class is not accessible due to restriction on required library"; may be shown while developing Java projects in Eclipse IDE. Error message is self-explanatory, some classes can not be loaded into the project since restriction rules are being imposed on those classes. 
How to solve 
This error message can be removed by changing a setting inside Eclipse IDE. Open up the dialog box shown below, using any of the following paths. 


Windows -> Preferences -> Java -> Compiler -> Errors/Warnings 
(Project) Properties -> Java Compiler -> Errors/Warnings 


Forbidden reference(access rules)  select warning 


这种方法会改变eclipse的全局行为,我的解决办法是把原来用的默认jre由eclipse目录下的,该为安装java的目录下的jre

很奇怪,eclipse的jre , 上一个project还好的,

Locate the "Forbidden reference (access rules)" option under "Deprecated and restricted API" section in the dialog box. This option decides how to handle access rules defined inside Eclipse. By default it is set to "Error" which causes Eclipse to complain about references to any restricted classes. Choosing any other option (Warning or Ignore) will remove these error messages. 


"Warning" or "Ignore" options will only hide the potential issue in the project, by allowing the project to use any classes ignoring predefined access rules. To completely resolve this issue, analyze the project and located the use of restricted classes and take necessary actions (either remove those references or access rules).


------------------------------------------------------------------------------------

调试java代码的时候, byte[]的变量总是显示成数字,如果要显示对应的字符

Window->Preference->Java->Debug->Primitive Display Options->Check some of them

原创粉丝点击