ClassfileParser

dotty.tools.dotc.core.classfile.ClassfileParser
See theClassfileParser companion object
class ClassfileParser(classfile: AbstractFile, classRoot: ClassDenotation, moduleRoot: ClassDenotation)(ictx: Context)

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Classlikes

Attributes

Graph
Supertypes
class LazyType
trait Symbol => LazyType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any

A completer for attributes

A completer for attributes

Top-level classes complete attributes eagerly, while members complete lazily.

Attributes

Note:

We cannot simply store the bytes of attributes, as the bytes may contain references to the constant pool, where the constants are loaded lazily.

Graph
Supertypes
class Object
trait Matchable
class Any
class ClassfileAnnotation(annotType: Type, lazyArgs: List[(NameOrString, Tree | EnumTag)]) extends LazyAnnotation

Attributes

Graph
Supertypes
trait Showable
class Object
trait Matchable
class Any
class ConstantPool(using in: DataReader)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
class EnumTag(sig: String, name: NameOrString)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
case class InnerClassEntry(external: NameOrString, outer: NameOrString, name: NameOrString, jflags: Int)

An entry in the InnerClasses attribute of this class file.

An entry in the InnerClasses attribute of this class file.

Attributes

Graph
Supertypes
trait Product
trait Equals
class Object
trait Matchable
class Any
class MemberCompleter(name: SimpleName, jflags: Int, sig: String) extends LazyType

Attributes

Graph
Supertypes
class LazyType
trait Symbol => LazyType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any

Value members

Concrete methods

Annotations in Scala are assumed to get all their arguments as constructor parameters. For Java annotations we need to fake it by making up the constructor.

Annotations in Scala are assumed to get all their arguments as constructor parameters. For Java annotations we need to fake it by making up the constructor.

Attributes

Add type parameters of enclosing classes

Add type parameters of enclosing classes

Attributes

Return the class symbol of the given name.

Return the class symbol of the given name.

Attributes

def constantTagToType(tag: Int)(using Context): Type
def convertTo(ct: Constant, pt: Type)(using Context): Constant

As specified in https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.16.1, an annotation argument of type boolean, byte, char or short will be represented as a CONSTANT_INTEGER, so we need to convert it to produce a correctly-typed tree. We need to do this each time the constant is accessed instead of storing the result of the conversion in the values cache, because the same constant might be used for annotation arguments of different type.

As specified in https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.16.1, an annotation argument of type boolean, byte, char or short will be represented as a CONSTANT_INTEGER, so we need to convert it to produce a correctly-typed tree. We need to do this each time the constant is accessed instead of storing the result of the conversion in the values cache, because the same constant might be used for annotation arguments of different type.

Attributes

def parseAnnotArg(skip: Boolean)(using ctx: Context, in: DataReader): Option[Tree | EnumTag]
def parseAnnotation(attrNameIndex: Char, skip: Boolean)(using ctx: Context, in: DataReader): Option[ClassfileAnnotation]

Parse and return a single annotation. If it is malformed, return None.

Parse and return a single annotation. If it is malformed, return None.

Attributes

def parseClass()(using ctx: Context, in: DataReader): Option[Embedded]
def parseMember(method: Boolean)(using ctx: Context, in: DataReader): Unit
def run()(using Context): Option[Embedded]
def skipAttributes()(using in: DataReader): Unit
def skipMembers()(using in: DataReader): Unit
def skipSuperclasses()(using in: DataReader): Unit

Parse inner classes. Expects in.bp to point to the superclass entry. Restores the old bp.

Parse inner classes. Expects in.bp to point to the superclass entry. Restores the old bp.

Attributes

Returns:

Some(unpickler) iff classfile is from Scala, so no Java info needs to be read.

Concrete fields