Java方法描述符中美元符号的含义? [英] Meanings of dollar sign in Java method descriptor?

查看:231
本文介绍了Java方法描述符中美元符号的含义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,它是Jikes RVM堆栈的一部分。

For example, its part of the Jikes RVM stack.

at [0x70cfba90, 0x708cfaa4] Lorg/apache/lucene/index/SegmentInfos; 
       **access$000**(Ljava/lang/String;)V
at [0x70cfbb04, 0x708b55c8] Lorg/apache/lucene/index/SegmentInfos$
       FindSegmentsFile; run()Ljava/lang/Object; at line 554
at [0x70cfbb24, 0x708c4a8d] Lorg/apache/lucene/index/SegmentInfos; 
       read(Lorg/apache/lucene/store/Directory;)V at line 272

'access'应该是方法名称。但我检查了类源代码及其接口,没有任何方法称为访问。我无法在Google上找到答案,因为Google讨厌各种标点符号。有人可以帮忙吗?非常感谢。

'access' should be a method name. But I checked the class source code and its interfaces, there is no method there called 'access'. I couldn't find an answer on Google, since Google hates all kinds of punctuations. Can anyone help here? Thanks very much.

推荐答案

引自文章 @birryree 链接:


如果一个类包含另一个类,或者它们被公共类包围,则另一个类D可以使用类C的私有成员m。由于虚拟机不知道这种分组,编译器在C中创建访问方法的本地协议,以允许D读取,写入或调用成员m。这些方法的名称形式为访问$ 0,访问$ 1等。它们永远不会公开。访问方法的独特之处在于它们可以添加到封闭类中,而不仅仅是内部类。

A private member m of a class C may be used by another class D, if one class encloses the other, or if they are enclosed by a common class. Since the virtual machine does not know about this sort of grouping, the compiler creates a local protocol of access methods in C to allow D to read, write, or call the member m. These methods have names of the form access$0, access$1, etc. They are never public. Access methods are unique in that they may be added to enclosing classes, not just inner classes.

这篇关于Java方法描述符中美元符号的含义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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