OutlineJavaParser

dotty.tools.dotc.parsing.JavaParsers.OutlineJavaParser
class OutlineJavaParser(source: SourceFile)(using x$2: Context) extends JavaParser, OutlineParserCommon

OutlineJavaParser parses top-level declarations in source to find declared classes, ignoring their bodies (which must only have balanced braces). This is used to map class names to defining sources. This is necessary even for Java, because the filename defining a non-public classes cannot be determined from the classname alone.

Attributes

Graph
Supertypes
class JavaParser
class ParserCommon
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def skipBracesHook(): Option[Tree]

Attributes

Definition Classes
override def typeBody(leadingToken: Int, parentName: Name): (List[Tree], List[Tree])

Attributes

Definition Classes

Inherited methods

def ObjectTpt(): Tree

Synthetic tree representing java.lang.Object. The typer will type all references to java.lang.Object as FromJavaObject.

Synthetic tree representing java.lang.Object. The typer will type all references to java.lang.Object as FromJavaObject.

Attributes

Inherited from:
JavaParser
def accept(token: Int): Int

Consume one token of the specified type, or signal an error if it is not there.

Consume one token of the specified type, or signal an error if it is not there.

Attributes

Returns

The offset at the start of the token to accept

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser

If the next token is the identifier "record", convert it into the RECORD token. This makes it easier to handle records in various parts of the code, in particular when a parentToken is passed to some functions.

If the next token is the identifier "record", convert it into the RECORD token. This makes it easier to handle records in various parts of the code, in particular when a parentToken is passed to some functions.

Attributes

Inherited from:
JavaParser
def addCompanionObject(statics: List[Tree], cdef: TypeDef): List[Tree]

Attributes

Inherited from:
JavaParser

Annotation ::= TypeName [( [AnnotationArgument {, AnnotationArgument}] )] AnnotationArgument ::= ElementValuePair | ELementValue ElementValuePair ::= Identifier = ElementValue ElementValue ::= ConstExpressionSubset | ElementValueArrayInitializer | Annotation ElementValueArrayInitializer ::= { [ElementValue {, ElementValue}] [,] } ConstExpressionSubset ::= Literal | QualifiedName | ClassLiteral

Annotation ::= TypeName [( [AnnotationArgument {, AnnotationArgument}] )] AnnotationArgument ::= ElementValuePair | ELementValue ElementValuePair ::= Identifier = ElementValue ElementValue ::= ConstExpressionSubset | ElementValueArrayInitializer | Annotation ElementValueArrayInitializer ::= { [ElementValue {, ElementValue}] [,] } ConstExpressionSubset ::= Literal | QualifiedName | ClassLiteral

We support only subset of const expressions expected in this context by java. If we encounter expression that we cannot parse, we do not raise parsing error, but instead we skip entire annotation silently.

Attributes

Inherited from:
JavaParser
def annotationDecl(start: Offset, mods: Modifiers): List[Tree]

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser
def atSpan[T <: Positioned](start: Offset)(t: T): T

Attributes

Inherited from:
ParserCommon
def atSpan[T <: Positioned](start: Offset, point: Offset)(t: T): T

If the last read offset is strictly greater than start, assign tree the span from start to last read offset, with given point. If the last offset is less than or equal to start, the tree t did not consume any source for its construction. In this case, don't assign a span yet, but wait for its span to be determined by setChildSpans when the parent node is positioned.

If the last read offset is strictly greater than start, assign tree the span from start to last read offset, with given point. If the last offset is less than or equal to start, the tree t did not consume any source for its construction. In this case, don't assign a span yet, but wait for its span to be determined by setChildSpans when the parent node is positioned.

Attributes

Inherited from:
ParserCommon
def atSpan[T <: Positioned](start: Offset, point: Offset, end: Offset)(t: T): T

Attributes

Inherited from:
ParserCommon
def atSpan[T <: Positioned](span: Span)(t: T): T

Positions tree. If t does not have a span yet, set its span to the given one.

Positions tree. If t does not have a span yet, set its span to the given one.

Attributes

Inherited from:
ParserCommon
def basicType(): Tree

Attributes

Inherited from:
JavaParser
def bound(): Tree

Attributes

Inherited from:
JavaParser
def classDecl(start: Offset, mods: Modifiers): List[Tree]

Attributes

Inherited from:
JavaParser

CompilationUnit ::= [package QualId semi] TopStatSeq

CompilationUnit ::= [package QualId semi] TopStatSeq

Attributes

Inherited from:
JavaParser
def convertToTypeId(tree: Tree): Tree

Convert (qual)ident to type identifier

Convert (qual)ident to type identifier

Attributes

Inherited from:
JavaParser

Translate names in Select/Ident nodes to type names.

Translate names in Select/Ident nodes to type names.

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
ParserCommon
def enumConst(enumType: Tree): ValDef

Attributes

Inherited from:
JavaParser
def enumDecl(start: Offset, mods: Modifiers): List[Tree]

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser

in.offset, except if this is at a new line, in which case lastOffset is preferred.

in.offset, except if this is at a new line, in which case lastOffset is preferred.

Attributes

Inherited from:
ParserCommon
def fieldDecls(start: Offset, firstNameOffset: Offset, mods: Modifiers, tpt: Tree, name: Name): List[Tree]

Parse a sequence of field declarations, separated by commas. This one is tricky because a comma might also appear in an initializer. Since we don't parse initializers we don't know what the comma signifies. We solve this with a second list buffer maybe which contains potential variable definitions. Once we have reached the end of the statement, we know whether these potential definitions are real or not.

Parse a sequence of field declarations, separated by commas. This one is tricky because a comma might also appear in an initializer. Since we don't parse initializers we don't know what the comma signifies. We solve this with a second list buffer maybe which contains potential variable definitions. Once we have reached the end of the statement, we know whether these potential definitions are real or not.

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser
def ident(): Name

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser
def importDecl(): List[Tree]

Attributes

Inherited from:
JavaParser
def interfaceDecl(start: Offset, mods: Modifiers): List[Tree]

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser
def javaDot(name: Name): Tree

Attributes

Inherited from:
JavaParser
def javaLangDot(name: Name): Tree

Attributes

Inherited from:
JavaParser

Tree representing java.lang.Record

Tree representing java.lang.Record

Attributes

Inherited from:
JavaParser
def makeCompanionObject(cdef: TypeDef, statics: List[Tree]): Tree

Attributes

Inherited from:
JavaParser
def makeConstructor(formals: List[Tree], tparams: List[TypeDef], body: Tree, flags: FlagSet): DefDef

Attributes

Inherited from:
JavaParser
def makeParam(name: TermName, tpt: Tree): ValDef

Attributes

Inherited from:
JavaParser
def makeSyntheticParam(count: Int, tpt: Tree): ValDef

Attributes

Inherited from:
JavaParser
def makeTemplate(parents: List[Tree], stats: List[Tree], tparams: List[TypeDef], needsDummyConstr: Boolean): Template

Attributes

Inherited from:
JavaParser
def memberDecl(start: Offset, mods: Modifiers, parentToken: Int): List[Tree]

Attributes

Inherited from:
JavaParser
def methodBody(): Tree

Attributes

Inherited from:
JavaParser
def modifiers(inInterface: Boolean): Modifiers

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
ParserCommon

Attributes

Inherited from:
JavaParser
def optThrows(): Unit

Attributes

Inherited from:
JavaParser
def parse(): Tree

This is the general parse entry point. Overridden by ScriptParser

This is the general parse entry point. Overridden by ScriptParser

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
ParserCommon
def qualId(): RefTree

Attributes

Inherited from:
JavaParser
def recordDecl(start: Offset, mods: Modifiers): List[Tree]

Attributes

Inherited from:
JavaParser
def repsep[T <: Tree](p: () => T, sep: Int): List[T]

Attributes

Inherited from:
JavaParser
def skipAhead(): Unit

skip parent or brace enclosed sequence of things

skip parent or brace enclosed sequence of things

Attributes

Inherited from:
JavaParser
def skipBraces(): Unit

Attributes

Inherited from:
OutlineParserCommon
def skipTo(tokens: Int*): Unit

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
ParserCommon
def syntaxError(msg: Message, span: Span): Unit

Unconditionally issue an error at given span, without updating lastErrorOffset.

Unconditionally issue an error at given span, without updating lastErrorOffset.

Attributes

Inherited from:
ParserCommon
def syntaxError(msg: Message, offset: Int): Unit

Issue an error at given offset if beyond last error offset and update lastErrorOffset.

Issue an error at given offset if beyond last error offset and update lastErrorOffset.

Attributes

Inherited from:
ParserCommon
def syntaxError(offset: Int, msg: Message, skipIt: Boolean): Unit

Attributes

Inherited from:
JavaParser
def syntaxError(msg: Message, skipIt: Boolean): Unit

Attributes

Inherited from:
JavaParser
def termDecl(start: Offset, mods: Modifiers, parentToken: Int): List[Tree]

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser
def typ(): Tree

Attributes

Inherited from:
JavaParser
def typeArgs(t: Tree): Tree

Attributes

Inherited from:
JavaParser
def typeBodyDecls(parentToken: Int, parentName: Name): (List[Tree], List[Tree])

Attributes

Inherited from:
JavaParser
def typeDecl(start: Offset, mods: Modifiers): List[Tree]

Attributes

Inherited from:
JavaParser
def typeParam(flags: FlagSet): TypeDef

Attributes

Inherited from:
JavaParser
def typeParams(flags: FlagSet): List[TypeDef]

Attributes

Inherited from:
JavaParser
def varDecl(mods: Modifiers, tpt: Tree, name: TermName): ValDef

Attributes

Inherited from:
JavaParser

Inherited fields

Attributes

Inherited from:
JavaParser

Attributes

Inherited from:
JavaParser
protected var lastErrorOffset: Int

The offset where the last syntax error was reported, or if a skip to a safepoint occurred afterwards, the offset of the safe point.

The offset where the last syntax error was reported, or if a skip to a safepoint occurred afterwards, the offset of the safe point.

Attributes

Inherited from:
ParserCommon