Chen Chao
Chen Chao
反编译出来的代码没有行数提示,说明你这个jar编译的时候没有行号信息,这种jar是不能被debug的。 一些未开源的商业jar包,没有行号信息是正常的,目的就是为了防止别人窃取代码。
和Maven无关,插件兼容Maven插件,如果是Maven项目,优先使用Maven插件的项目下载源码。如果Maven无法下载源码,插件会按照自己的搜寻逻辑下载代码。如果没有忽略源代码,是优先使用下载的源代码的,而不会去反编译Class。 如果使用的是源代码,是无需行号信息,只有反编译出来的代码才需要行号。插件会判断是源代码还是反编译的代码。 至于 source not found,如果是远程debug的话,有可能是包含class的jar包没有包含在Debug的ClassPath里面,需要设置一下。把包含Class的jar包添加到ClassPath里面。  如果不是远程debug,能不能把截几张相关的图片给我看一下。我模拟一下环境测试一下。
你这个是在 Maven Build 里debug吗? 在Maven Test里debug?我没用过这个Case。 怎么能够通过Maven Build进入应用的断点?我在Test case里设置断点,然后运行Maven Build,不会进入断点。
最终能否调用反编译插件,是和Eclipse的JDT(Java Debug Tool)插件行为有关。普通Web项目是WTP插件完成的,它扩展了JDT,有自己的debug机制。Maven 插件我看了下,应该是同时扩展了JDT和WTP。 要调用反编译插件,首先需要找到对应的Class,这个由JDT来控制的。反编译插件本身对此无能为力。
 只要是Libaray下的Class,都在Classpath下面,都可以调用反编译插件。这里面当然也包括了Web App Libraries
Debug跟了一下,Maven Build时,debug 搜寻代码是通过 org.eclipse.m2e.internal.launch.MavenSourceLocator 完成的。  参照debug栈信息得知,对于Maven Build Debug过程中的代码搜寻工作,是由Maven 插件完成的。搜寻的路径包括JRE 相关的ClassPath的jar,Maven Debug配置项里的ClassPath中的jar。但是它不会返回Maven Debug里的ClassPath 的jar,而是返回Maven Debug ClassPath 里的jar的对应source jar包。因此它会直接用org.eclipse.jdt.ui.CompilationUnitEditor打开查找到的Java文件。
无法重现,可能跟你的项目有关,理论上只有Classpath上的jar包才会触发反编译插件的右键菜单。
Could you provide a simple example and dependent jars? thanks!
The source is decompiled by the decompiler, and plugin recombine the source code by the line number. If the class is complex, the recombined source code may not correct, then...
I merge one empty line or the first line after the comment line at the source code, so the debugger shouldn't off one line when debugging. If it off one...