ClassfileParser

class ClassfileParser(classfile: AbstractFile, classRoot: ClassDenotation, moduleRoot: ClassDenotation)(ictx: Context)
Companion
object
class Object
trait Matchable
class Any

Type members

Classlikes

A completer for attributes

A completer for attributes

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

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.

class ClassfileAnnotation(annotType: Type, lazyArgs: List[(NameOrString, Tree | EnumTag)]) extends LazyAnnotation
class ConstantPool(using in: DataReader)
class EnumTag(sig: String, name: NameOrString)
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.

class MemberCompleter(name: SimpleName, jflags: Int, sig: String) extends LazyType

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.

Add type parameters of enclosing classes

Add type parameters of enclosing classes

def classNameToSymbol(name: Name)(using Context): Symbol

Return the class symbol of the given name.

Return the class symbol of the given name.

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.

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.

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

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.

Returns

true iff classfile is from Scala, so no Java info needs to be read.

Concrete fields