处理反编译代码中的标签
我希望返回到一个项目,该项目之前已经丢失了源代码,但已设法从用户那里获得了编译版本。我使用了一些反编译器来慢慢地再次拼凑代码,但我被两个最终的“标签”困住了。
在过去三天尝试了一系列反编译器之后,却发现大多数反编译器都发现这些片段更加困难,我来到这里作为最后的手段。我知道这是一个相当大的请求,特别是因为缺少上下文并且它所呈现的内容是不寻常的,但幸运的是,有经验的人将能够理解这一点。
下面的代码片段有“label337”,我不知道如何解决。我知道它们是某种指针,但我没有想到如何重新排列代码。 JD-GUI 生成的输出。 http://pastebin.com/mVNksm13
以下代码段有“label711”,我也不知道该怎么做和。虽然断章取义,但它是一个完整的条件,尽管我不知道它有多大意义。 JD-GUI 生成的输出。 http://pastebin.com/5MLFxHPb
我想再次重申,我知道这个请求有多么重要但在厌倦了 Java 或反编译器之后,我来到这里,希望能对这个场景有比我已经知道的更多的了解。
编辑: 我试图反编译的 jar 严重依赖于我有权访问的另一个 jar。以某种方式指向反编译期间类所依赖的 jar 会产生更好的输出吗?我尝试寻找如何在反编译器中链接到此类依赖项,但一无所获。
I'm wishing to return to a project to which I have lost source to a time ago but have managed to get the compiled version from a user. I've used a few decompilers to slowly piece together the code again but am stuck with two final 'labels'.
After spending the past three days trying a range of decompilers only to find that most of them find these snippets even more of a struggle I am coming here as a last resort. I understand this is quite a large request especially as the context is missing and what is present of it is unusual but with a bit of luck someone experienced will be able to make sense of this.
The following snippet has 'label337' which I have no clue how to work around. I understand they are pointers of sorts but it does not occur to me how I would rearrange the code. Output produced by JD-GUI.
http://pastebin.com/mVNksm13
The following snippet has 'label711' which I am also unaware of what to do with. Although taken hugely out of context it's an entire conditional although I don't know how much of sense it will make. Output produced by JD-GUI.
http://pastebin.com/5MLFxHPb
Once again I wish to reiterate that I am aware how great of a request this is but after becoming sick of the sight of Java or decompilers I come here in hopes that any further light can be shed on this scenario than what I already know.
EDIT:
The jar I am trying to decompile is heavily dependent on another jar which I have access to. Would somehow pointing to the jar on which the classes are dependent on during decompilation produce better output? I tried searching for how I would link to such dependancies in a decompiler but found nothing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我正确理解您的问题,您正在寻求重构粘贴的代码。中断就像 GOTO 语句。重构此代码的最简单方法是使用方法。
您有一个很长的 if/else 语句,如果将其移到方法中,您将可以使用 return 语句。这是您的第一个示例的缩写形式,
而不是创建新方法来执行您的逻辑
,现在您的代码被缩短为
此外,在您的原始情况下,您很可能会遇到编译错误“标签 label337 丢失”,因为它是在之后声明的它的用途。使用方法也将有助于消除该错误。
If I understand your question properly you are looking to refactor the pasted code. The breaks are like GOTO statements. The easiest way to re-factor this code would be with the use of methods.
You have one long if/else statement which if moved into a method would allow you to use return statements instead. Here is a shortened form of your first example
instead of this create new methods to perform your logic
now your code is shortened to
Also in your original case, you most likely have a compilation error "The label label337 is missing" since it is declared after its use. using methods will help remove that error as well.
看起来你的反编译器搞砸了,并将标签放在了错误的位置。至少对于第一个示例,如果将 label337 移动到发生中断的最外层 for 循环,它应该可以正常编译并执行您所期望的操作。对于另一个,您必须修改 if 块以接近最后一个中断才能进行编译。
以下是有关如何使用带有标签的中断的简要教程: http:// download.oracle.com/javase/tutorial/java/nutsandbolts/branch.html
That looks like your decompiler messed up and put the labels in the wrong spot. At least for the first example, if you move label337 to the outer most for-loop in which the breaks occur, it should compile just fine and do what you expect. For the other one, you will have to modify the if block to near the last break to get to compile.
Here is a brief tutorial on how to use breaks with labels: http://download.oracle.com/javase/tutorial/java/nutsandbolts/branch.html