这是什么参考? [英] What is this referencing?

查看:119
本文介绍了这是什么参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有这个类:

public class class1 extends Applet implements Runnable
{
    private String s;
    private URL u;
    ...
}

第二类:

class TS extends Thread
{
    private final class1 _$97913;
    public TS(class1 paramclass1)
    {
        this._$97913 = paramclass1;
    }
    ...
    public void PostData()
    {
        ...
        class1.access$16(this._$97913, new Socket(class1.access$17(this._$97913), 80);
        ...
    }
    ...
}

有人可以解释 class1.access 16美元(这个._ $ 97913,新套接字(class1.access $ 17(此._ $ 97913)) ,80); 从class1引用私人网址u;

Can someone explain how class1.access$16(this._$97913, new Socket(class1.access$17(this._$97913), 80); is referencing private URL u; from class1?

哪里可以访问$ 16 来自?这叫什么?我在哪里可以了解更多信息?

Where does the access$16 come from? What is this called and where can I learn more about it?

好的,这个是反编译代码的结果,有没有办法关联数字(访问$ 16 访问$ 17 等。 )对于原始变量或类?从我所看到的,唯一的方法是手动执行(即查看被引用的内容并猜测,因为'此'类接收到URL,然后'this'必须关联用'那个'变量)?

Ok, this being the result of decompiled code, is there a way to associate the numbers (access$16, access$17, etc.) to the original variable or class? From what I can see, the only way would be to do so manually (i.e. see what is being referenced where and guess that since 'this' class received a URL, then 'this' must be associated with 'that' variable)?

推荐答案


好的,这是反编译代码的结果,有没有办法将数字关联
访问$ 16 访问原始变量或类的$ 17 等)?从我所看到的,
唯一的方法就是手动执行(即查看被引用的内容和
猜测,因为'this'类收到了一个URL,然后'this'必须关联使用'那'变量)?

Ok, this being the result of decompiled code, is there a way to associate the numbers (access$16, access$17, etc.) to the original variable or class? From what I can see, the only way would be to do so manually (i.e. see what is being referenced where and guess that since 'this' class received a URL, then 'this' must be associated with 'that' variable)?

创建访问$ x 方法如果您从嵌套类(或其他方式,或从一个嵌套类到另一个嵌套类)访问私有方法或变量。它们是由编译器创建的,因为VM不允许直接访问私有变量。

The access$x methods are created if you access private methods or variables from a nested class (or the other way around, or from one nested class to another). They are created by the compiler, since the VM does not allow direct access to private variables.

如果反编译器允许这些方法调用保留在重新创建的源代码中以供使用在类中,它还应该让合成方法定义保留在已使用类的重新创建的源代码中。如果是这样,看看有问题的方法的接收者的类(在你的情况下是 class1 ),应该有这样的方法(访问$ 17 )。在这个方法的代码中,你可以看到这里访问了哪个真正的方法(或变量)。

If the decompiler lets these method calls stay in the recreated source code for the using class, it should also let the synthetic methods definitions stay in the recreated source code for the used class. If so, have a look at the class which is the receiver of the method in question (class1 in your case), there should be such a method (access$17). In the code of this method you can see which real method (or variable) is accessed here.

如果反编译器删除了合成方法,这可能是一个bug,或者它可以是可配置的。也可能是你必须立即将所有类传递给它,然后它可以在任何地方放入正确的方法/字段 - 查看它的文档。

If the decompiler removed the synthetic methods, this is either a bug, or it may be configurable. It could also be that you have to pass it all the classes at once, and then it can put in the right methods/fields everywhere - look at its documentation.

如果你有方法调用的点之前的类(及其超类,如果有的话),你应该有方法。

If you have the classes before the dot of a method call (and their superclasses, if any), you should have the methods.

从您发布的代码段中,应该有访问$ 16 访问$ 17 class1 中的方法(或 class1 这里是一个局部变量?)。

From the snippet you posted, there should be a access$16 and access$17 method in class1 (or is class1 a local variable here?).

如果不是,也许你的反编译器试图更聪明,那么他应该。您可以查看 javap class1 的输出以查看方法是否存在,并且 javap -c class1 对于整个字节码。或者使用另一个反编译器。

If it isn't, maybe your decompiler tried to be smarter then he should. You could have a look at the output of javap class1 to see if the methods are there, and javap -c class1 for the whole bytecode. Or use another decompiler.

这篇关于这是什么参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆