来看一下继承自Symbol的具体实现类。
1、TypeSymbol
/** A class for type symbols. * Type variables are represented by instances of this class, // 类型变量用这个类来表示 * classes and packages by instances of subclasses. // 类和包用子类来表示 */ public class TypeSymbol extends Symbol implements TypeParameterElement { ... }
2、PackageSymbol
/** A class for package symbols */ public class PackageSymbol extends TypeSymbol implements PackageElement { public Scope members_field; public Name fullname; public ClassSymbol package_info; // see bug 6443073 ... }
主要有3个属性。
3、ClassSymbol
/** A class for class symbols */ public class ClassSymbol extends TypeSymbol implements TypeElement { /** a scope for all class members; variables, methods and inner classes * type parameters are not part of this scope * * 所有类成员的一个作用域。变量,方法和内部类 类型参数不是这个作用域的一部分 */ public Scope members_field; /** the fully qualified name of the class, i.e. pck.outer.inner. * null for anonymous classes * * 类的全限定名,对于匿名类为空 */ public Name fullname; /** the fully qualified name of the class after converting to flat * representation, i.e. pck.outer$inner, * set externally for local and anonymous classes * * 类的全限定名,为本地和匿名类也进行设置 */ public Name flatname; /** the sourcefile where the class came from */ public JavaFileObject sourcefile; /** the classfile from where to load this class * this will have extension .class or .java */ public JavaFileObject classfile; /** the list of translated local classes (used for generating InnerClasses attribute) */ public List<ClassSymbol> trans_local; /** the constant pool of the class */ public Pool pool; ... }
时间: 2024-10-10 07:03:14