jsr 关键字是什么意思?

发布于 2024-10-04 17:51:37 字数 326 浏览 6 评论 0原文

我正在查看一些 Java 代码,我注意到以下内容:

if (!foo(bar, baz, qux)) {
    i = 0; jsr 433;
}

javac 被阻塞,说这不是一个语句,并且在关键字 jsr 之后需要一个分号。

我做了一些谷歌搜索,发现一些包含相同内容的代码,这让我相信它是故意存在的(甚至尽管他们也无法编译它)。那么 jsr 是做什么的呢?如何获得包含它的代码进行编译?

I'm looking at some Java code, and I've noticed the following:

if (!foo(bar, baz, qux)) {
    i = 0; jsr 433;
}

javac chokes on it, saying it's not a statement and that a semicolon is expected after the keyword jsr.

I did some Googling, and I found some code containing the same thing, which leads me to believe it's there intentionally (even though they weren't able to get it to compile either). So what does jsr do? How does one get code containing it to compile?

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

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

发布评论

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

评论(6

故人的歌 2024-10-11 17:51:37

我几乎可以肯定这段代码来自 Java 反编译器。

JSR 432 闻起来像反编译器注释,其中反编译器发现了“跳转”代码,但不知道如何用 java 语言表达它。

I'm close to sure that this code is coming from a Java decompiler.

The JSR 432 smells like a decompiler note, where the decompiler found a "jump" code but doesn't have a clue on how to express it in java language.

在你怀里撒娇 2024-10-11 17:51:37

jsr 433 不是有效的 Java 语句。它是一条 VM 指令,代表“跳转到子例程”(请参阅​​ VM 规范 了解更多信息)。反编译器插入它是因为它不理解字节码指令(也许它被混淆了),因此无法将其反编译为有效的 Java 源代码。

jsr 433 is not a valid Java statement. It is a VM instruction which stands for "Jump to Sub Routine" (See the VM Spec for more information). The decompiler inserted it because it didn't understand the bytecode instruction (perhaps it was obfuscated) and so couldn't decompile it into valid Java source.

魂牵梦绕锁你心扉 2024-10-11 17:51:37

您很可能会看到反编译某些反编译器无法处理的代码的结果。 JSR是跳转子程序字节码的助记符;请参阅此页面了解列表。因此 jsr 432 可能意味着在字节码地址 432 处调用私有方法。但是,反编译器无法弄清楚这一点,因此该方法可能是合成的,或者发生了其他情况。

编辑

您发现的 Google 示例肯定是反编译器输出,看起来 JSR 部分要么是由混淆、字节码修改/生成造成的,要么是由反编译器填充造成的。

You are most likely looking at the results of decompiling some code which the decompiler wasn't able to cope with. JSR is the mnemonic for the jump subroutine bytecode; see this page for a listing. So jsr 432 may mean call a private method at bytecode address 432. However, the decompiler cannot figure that out, so maybe the method is synthetic, or something else is going on.

EDIT

Googled example you found is definitely decompiler output, and it looks like the part with the JSRs is either cause by obfuscation, byte code modification / generation, or by a decompiler stuffup.

她说她爱他 2024-10-11 17:51:37

JSR 代表 Java 规范请求。

该代码中可能有一个拼写错误,应该是

if (!foo(bar, baz, qux)) {
    i = 0; //jsr 433;
}

在我看来,有人由于某种原因进行了无效的签入。

但是,看看该代码,它看起来非常人为,因此它可能是反编译的代码,正如 Andreas_D 已经指出的那样。

迷你更新:检查底部评论:

/* Location:           C:\Users\Matteo\Downloads\FreeDownApplet.signed.jar
 * Qualified Name:     FreeDownApplet
 * JD-Core Version:    0.5.4
 */

据此,我想说有人制作了一个经过混淆的签名 jar 文件,并且发布该代码的人对其进行了反编译。

更新2:谷歌搜索“JD core”会产生http://java.decompiler.free。 fr/ 作为第一个结果。

JSR stands for Java Specification Request.

There's probably a typo in that code and it should have been

if (!foo(bar, baz, qux)) {
    i = 0; //jsr 433;
}

It seems to me that somebody did a non working checkin for some reason.

But, looking at that code, it looks awfully artificial, so it's probably decompiled code, as Andreas_D already stated.

Mini update: check the bottom comment:

/* Location:           C:\Users\Matteo\Downloads\FreeDownApplet.signed.jar
 * Qualified Name:     FreeDownApplet
 * JD-Core Version:    0.5.4
 */

From this, I'd say somebody made a signed jar file that was obfuscated, and whoever posted that code decompiled it.

Update 2: Googling "JD core" yields http://java.decompiler.free.fr/ as the first result.

尤怨 2024-10-11 17:51:37

它不在 Java 关键字列表中。所以我不相信它有任何意义。我怀疑是否可以编译它。

It is not in the list of Java keywords. So I don't believe it has any meaning. And I doubt it's possible to compile it.

沫离伤花 2024-10-11 17:51:37

JSR(代表跳转子例程)是 Java 虚拟机规范的一部分。它是 JVM 的指令集。

简要说明

操作码的地址
紧接着此指令
jsr指令被推送到
作为类型值的操作数堆栈
返回地址

这可以在 JVM 书籍第二版

JSR (which stands for Jump Subroutine) is part of the Java Virtual Machine Specification. It's a instruction set for the JVM.

Brief description

The address of the opcode of the
instruction immediately following this
jsr instruction is pushed onto the
operand stack as a value of type
returnAddress.

This can be found on the JVM book 2nd edition.

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