import { Markers } from "../markers"; import { SourceFile, Tree } from "../tree"; import { Type } from "./type"; export interface J extends Tree { readonly prefix: J.Space; } export declare namespace J { function isMethodCall(e?: Expression): e is MethodCall; function hasType(tree: T): tree is T & { type: Type; }; } export interface Expression extends J { readonly type?: Type; } export interface MethodCall extends Expression { readonly methodType?: Type.Method; } export interface TypedTree extends J { } export interface NameTree extends TypedTree { } export interface TypeTree extends NameTree { } export interface VariableDeclarator extends J { } export interface JavaSourceFile extends J, SourceFile { readonly packageDeclaration: J.RightPadded; readonly imports: J.RightPadded[]; readonly classes: J.ClassDeclaration[]; } export interface Statement extends J { } export interface NameTree extends J { } export declare namespace J { const Kind: { readonly AnnotatedType: "org.openrewrite.java.tree.J$AnnotatedType"; readonly Annotation: "org.openrewrite.java.tree.J$Annotation"; readonly ArrayAccess: "org.openrewrite.java.tree.J$ArrayAccess"; readonly ArrayDimension: "org.openrewrite.java.tree.J$ArrayDimension"; readonly ArrayType: "org.openrewrite.java.tree.J$ArrayType"; readonly Assert: "org.openrewrite.java.tree.J$Assert"; readonly Assignment: "org.openrewrite.java.tree.J$Assignment"; readonly AssignmentOperation: "org.openrewrite.java.tree.J$AssignmentOperation"; readonly Binary: "org.openrewrite.java.tree.J$Binary"; readonly Block: "org.openrewrite.java.tree.J$Block"; readonly Break: "org.openrewrite.java.tree.J$Break"; readonly Case: "org.openrewrite.java.tree.J$Case"; readonly ClassDeclaration: "org.openrewrite.java.tree.J$ClassDeclaration"; readonly ClassDeclarationKind: "org.openrewrite.java.tree.J$ClassDeclaration$Kind"; readonly ControlParentheses: "org.openrewrite.java.tree.J$ControlParentheses"; readonly CompilationUnit: "org.openrewrite.java.tree.J$CompilationUnit"; readonly Continue: "org.openrewrite.java.tree.J$Continue"; readonly DeconstructionPattern: "org.openrewrite.java.tree.J$DeconstructionPattern"; readonly DoWhileLoop: "org.openrewrite.java.tree.J$DoWhileLoop"; readonly Empty: "org.openrewrite.java.tree.J$Empty"; readonly EnumValueSet: "org.openrewrite.java.tree.J$EnumValueSet"; readonly EnumValue: "org.openrewrite.java.tree.J$EnumValue"; readonly Erroneous: "org.openrewrite.java.tree.J$Erroneous"; readonly FieldAccess: "org.openrewrite.java.tree.J$FieldAccess"; readonly ForEachLoop: "org.openrewrite.java.tree.J$ForEachLoop"; readonly ForEachLoopControl: "org.openrewrite.java.tree.J$ForEachLoop$Control"; readonly ForLoop: "org.openrewrite.java.tree.J$ForLoop"; readonly ForLoopControl: "org.openrewrite.java.tree.J$ForLoop$Control"; readonly Identifier: "org.openrewrite.java.tree.J$Identifier"; readonly If: "org.openrewrite.java.tree.J$If"; readonly IfElse: "org.openrewrite.java.tree.J$If$Else"; readonly Import: "org.openrewrite.java.tree.J$Import"; readonly InstanceOf: "org.openrewrite.java.tree.J$InstanceOf"; readonly IntersectionType: "org.openrewrite.java.tree.J$IntersectionType"; readonly Label: "org.openrewrite.java.tree.J$Label"; readonly Lambda: "org.openrewrite.java.tree.J$Lambda"; readonly LambdaParameters: "org.openrewrite.java.tree.J$Lambda$Parameters"; readonly Literal: "org.openrewrite.java.tree.J$Literal"; readonly MemberReference: "org.openrewrite.java.tree.J$MemberReference"; readonly MethodDeclaration: "org.openrewrite.java.tree.J$MethodDeclaration"; readonly MethodInvocation: "org.openrewrite.java.tree.J$MethodInvocation"; readonly Modifier: "org.openrewrite.java.tree.J$Modifier"; readonly MultiCatch: "org.openrewrite.java.tree.J$MultiCatch"; readonly NamedVariable: "org.openrewrite.java.tree.J$VariableDeclarations$NamedVariable"; readonly NewArray: "org.openrewrite.java.tree.J$NewArray"; readonly NewClass: "org.openrewrite.java.tree.J$NewClass"; readonly NullableType: "org.openrewrite.java.tree.J$NullableType"; readonly Package: "org.openrewrite.java.tree.J$Package"; readonly ParameterizedType: "org.openrewrite.java.tree.J$ParameterizedType"; readonly Parentheses: "org.openrewrite.java.tree.J$Parentheses"; readonly ParenthesizedTypeTree: "org.openrewrite.java.tree.J$ParenthesizedTypeTree"; readonly Primitive: "org.openrewrite.java.tree.J$Primitive"; readonly Return: "org.openrewrite.java.tree.J$Return"; readonly Switch: "org.openrewrite.java.tree.J$Switch"; readonly SwitchExpression: "org.openrewrite.java.tree.J$SwitchExpression"; readonly Synchronized: "org.openrewrite.java.tree.J$Synchronized"; readonly Ternary: "org.openrewrite.java.tree.J$Ternary"; readonly TextComment: "org.openrewrite.java.tree.TextComment"; readonly Throw: "org.openrewrite.java.tree.J$Throw"; readonly Try: "org.openrewrite.java.tree.J$Try"; readonly TryResource: "org.openrewrite.java.tree.J$Try$Resource"; readonly TryCatch: "org.openrewrite.java.tree.J$Try$Catch"; readonly TypeCast: "org.openrewrite.java.tree.J$TypeCast"; readonly TypeParameter: "org.openrewrite.java.tree.J$TypeParameter"; readonly TypeParameters: "org.openrewrite.java.tree.J$TypeParameters"; readonly Unary: "org.openrewrite.java.tree.J$Unary"; readonly Unknown: "org.openrewrite.java.tree.J$Unknown"; readonly UnknownSource: "org.openrewrite.java.tree.J$Unknown$Source"; readonly VariableDeclarations: "org.openrewrite.java.tree.J$VariableDeclarations"; readonly WhileLoop: "org.openrewrite.java.tree.J$WhileLoop"; readonly Wildcard: "org.openrewrite.java.tree.J$Wildcard"; readonly Yield: "org.openrewrite.java.tree.J$Yield"; readonly Container: "org.openrewrite.java.tree.JContainer"; readonly LeftPadded: "org.openrewrite.java.tree.JLeftPadded"; readonly RightPadded: "org.openrewrite.java.tree.JRightPadded"; readonly Space: "org.openrewrite.java.tree.Space"; }; interface AnnotatedType extends J, TypeTree, Expression { readonly kind: typeof Kind.AnnotatedType; readonly annotations: Annotation[]; readonly typeExpression: TypeTree; } interface Annotation extends J, Expression { readonly kind: typeof Kind.Annotation; readonly annotationType: NameTree; readonly arguments?: Container; } interface ArrayAccess extends J, TypedTree, Expression { readonly kind: typeof Kind.ArrayAccess; readonly indexed: Expression; readonly dimension: ArrayDimension; readonly type?: Type; } interface ArrayDimension extends J { readonly kind: typeof Kind.ArrayDimension; readonly index: RightPadded; } interface ArrayType extends J, TypeTree, Expression { readonly kind: typeof Kind.ArrayType; readonly elementType: TypeTree; readonly annotations?: Annotation[]; readonly dimension: LeftPadded; readonly type?: Type; } interface Assert extends J, Statement { readonly kind: typeof Kind.Assert; readonly condition: Expression; readonly detail?: LeftPadded; } interface Assignment extends J, Statement, Expression, TypedTree { readonly kind: typeof Kind.Assignment; readonly variable: Expression; readonly assignment: LeftPadded; readonly type?: Type; } interface AssignmentOperation extends J, Statement, Expression, TypedTree { readonly kind: typeof Kind.AssignmentOperation; readonly variable: Expression; readonly operator: LeftPadded; readonly assignment: Expression; readonly type?: Type; } namespace AssignmentOperation { const enum Type { Addition = "Addition", BitAnd = "BitAnd", BitOr = "BitOr", BitXor = "BitXor", Division = "Division", Exponentiation = "Exponentiation",// Raises the left operand to the power of the right operand. Used in Python FloorDivision = "FloorDivision",// Division rounding down to the nearest integer. Used in Python LeftShift = "LeftShift", MatrixMultiplication = "MatrixMultiplication",// Matrix multiplication. Used in Python Modulo = "Modulo", Multiplication = "Multiplication", RightShift = "RightShift", Subtraction = "Subtraction", UnsignedRightShift = "UnsignedRightShift" } } interface Binary extends J, Expression, TypedTree { readonly kind: typeof Kind.Binary; readonly left: Expression; readonly operator: LeftPadded; readonly right: Expression; readonly type?: Type; } namespace Binary { const enum Type { Addition = "Addition", Subtraction = "Subtraction", Multiplication = "Multiplication", Division = "Division", Modulo = "Modulo", LessThan = "LessThan", GreaterThan = "GreaterThan", LessThanOrEqual = "LessThanOrEqual", GreaterThanOrEqual = "GreaterThanOrEqual", Equal = "Equal", NotEqual = "NotEqual", BitAnd = "BitAnd", BitOr = "BitOr", BitXor = "BitXor", LeftShift = "LeftShift", RightShift = "RightShift", UnsignedRightShift = "UnsignedRightShift", Or = "Or", And = "And" } } interface Block extends J { readonly kind: typeof Kind.Block; readonly static: RightPadded; readonly statements: RightPadded[]; readonly end: J.Space; } interface Break extends J, Statement { readonly kind: typeof Kind.Break; readonly label?: Identifier; } interface Case extends J, Statement { readonly kind: typeof Kind.Case; readonly type: Case.Type; readonly caseLabels: Container; readonly statements: Container; readonly body?: RightPadded; readonly guard?: Expression; } namespace Case { const enum Type { Statement = "Statement", Rule = "Rule" } } interface ClassDeclaration extends J, Statement, TypedTree { readonly kind: typeof Kind.ClassDeclaration; readonly leadingAnnotations: Annotation[]; readonly modifiers: Modifier[]; readonly classKind: ClassDeclaration.Kind; readonly name: Identifier; readonly typeParameters?: Container; readonly primaryConstructor?: Container; readonly extends?: LeftPadded; readonly implements?: Container; readonly permitting?: Container; readonly body: Block; readonly type?: Type.FullyQualified; } namespace ClassDeclaration { interface Kind extends J { readonly kind: typeof J.Kind.ClassDeclarationKind; readonly annotations: Annotation[]; readonly type: Kind.Type; } namespace Kind { const enum Type { Class = "Class", Interface = "Interface", Enum = "Enum", Annotation = "Annotation", Record = "Record", Value = "Value" } } } interface CompilationUnit extends JavaSourceFile, J { readonly kind: typeof Kind.CompilationUnit; readonly eof: Space; } interface Continue extends J, Statement { readonly kind: typeof Kind.Continue; readonly label?: Identifier; } interface DoWhileLoop extends J, Statement { readonly kind: typeof Kind.DoWhileLoop; readonly body: RightPadded; readonly whileCondition: LeftPadded>; } interface Empty extends J, Statement, TypeTree, Expression { readonly kind: typeof Kind.Empty; } interface EnumValue extends J { readonly kind: typeof Kind.EnumValue; readonly annotations: Annotation[]; readonly name: Identifier; readonly initializer?: NewClass; } interface EnumValueSet extends J, Statement { readonly kind: typeof Kind.EnumValueSet; readonly enums: RightPadded[]; readonly terminatedWithSemicolon: boolean; } interface FieldAccess extends Statement, Expression, TypeTree { readonly kind: typeof Kind.FieldAccess; readonly target: Expression; readonly name: LeftPadded; readonly type?: Type; } interface ForEachLoop extends J, Statement { readonly kind: typeof Kind.ForEachLoop; readonly control: ForEachLoop.Control; readonly body: RightPadded; } namespace ForEachLoop { interface Control extends J { readonly kind: typeof Kind.ForEachLoopControl; readonly variable: RightPadded; readonly iterable: RightPadded; } } interface ForLoop extends J, Statement { readonly kind: typeof Kind.ForLoop; readonly control: ForLoop.Control; readonly body: RightPadded; } namespace ForLoop { interface Control extends J { readonly kind: typeof Kind.ForLoopControl; readonly init: RightPadded[]; readonly condition?: RightPadded; readonly update: RightPadded[]; } } interface ParenthesizedTypeTree extends J, TypeTree, Expression { readonly kind: typeof Kind.ParenthesizedTypeTree; readonly annotations: Annotation[]; readonly parenthesizedType: Parentheses; } interface Identifier extends J, TypeTree, Expression, VariableDeclarator { readonly kind: typeof Kind.Identifier; readonly annotations: Annotation[]; readonly simpleName: string; readonly type?: Type; readonly fieldType?: Type.Variable; } interface If extends J, Statement { readonly kind: typeof Kind.If; readonly ifCondition: ControlParentheses; readonly thenPart: RightPadded; readonly elsePart?: If.Else; } namespace If { interface Else extends J { readonly kind: typeof Kind.IfElse; readonly body: RightPadded; } } interface Import extends J { readonly kind: typeof Kind.Import; readonly static: LeftPadded; readonly qualid: FieldAccess; readonly alias?: LeftPadded; } interface InstanceOf extends J, Expression, TypedTree { readonly kind: typeof Kind.InstanceOf; readonly expression: RightPadded; readonly class: J; readonly pattern?: J; readonly type?: Type; readonly modifier?: Modifier; } interface DeconstructionPattern extends J, TypedTree { readonly kind: typeof Kind.DeconstructionPattern; readonly deconstructor: Expression; readonly nested: Container; readonly type?: Type; } interface IntersectionType extends J, TypeTree, Expression { readonly kind: typeof Kind.IntersectionType; readonly bounds: Container; readonly type?: Type; } interface Label extends J, Statement { readonly kind: typeof Kind.Label; readonly label: RightPadded; readonly statement: Statement; } interface Lambda extends J, Statement, TypedTree, Expression { readonly kind: typeof Kind.Lambda; readonly parameters: Lambda.Parameters; readonly arrow: Space; readonly body: Statement | Expression; readonly type?: Type; } namespace Lambda { interface Parameters extends J { readonly kind: typeof Kind.LambdaParameters; readonly parenthesized: boolean; readonly parameters: RightPadded[]; } } interface Literal extends J, TypedTree, Expression, VariableDeclarator { readonly kind: typeof Kind.Literal; readonly value?: string | number | bigint | boolean | null | undefined; readonly valueSource?: string; readonly unicodeEscapes?: LiteralUnicodeEscape[]; readonly type?: Type.Primitive; } interface LiteralUnicodeEscape { readonly valueSourceIndex: number; readonly codePoint: string; } interface MemberReference extends J, MethodCall { readonly kind: typeof Kind.MemberReference; readonly containing: RightPadded; readonly typeParameters?: Container; readonly reference: LeftPadded; readonly type?: Type; readonly variableType?: Type.Variable; } interface MethodDeclaration extends J, TypedTree { readonly kind: typeof Kind.MethodDeclaration; readonly leadingAnnotations: Annotation[]; readonly modifiers: Modifier[]; readonly typeParameters?: TypeParameters; readonly returnTypeExpression?: TypeTree; readonly nameAnnotations: Annotation[]; readonly name: Identifier; readonly parameters: Container; readonly dimensionsAfterName: LeftPadded[]; readonly throws?: Container; readonly body?: Block; readonly defaultValue?: LeftPadded; readonly methodType?: Type.Method; } interface MethodInvocation extends J, TypedTree, MethodCall { readonly kind: typeof Kind.MethodInvocation; readonly select?: RightPadded; readonly typeParameters?: Container; readonly name: Identifier; readonly arguments: Container; } interface Modifier extends J { readonly kind: typeof Kind.Modifier; readonly keyword?: string; readonly type: ModifierType; readonly annotations: Annotation[]; } const enum ModifierType { Default = "Default", Public = "Public", Protected = "Protected", Private = "Private", Abstract = "Abstract", Static = "Static", Final = "Final", Sealed = "Sealed", NonSealed = "NonSealed", Transient = "Transient", Volatile = "Volatile", Synchronized = "Synchronized", Native = "Native", Strictfp = "Strictfp", Async = "Async", Reified = "Reified", Inline = "Inline", /** * For modifiers not seen in Java this is used in conjunction with "keyword" */ LanguageExtension = "LanguageExtension" } interface MultiCatch extends J, TypeTree { readonly kind: typeof Kind.MultiCatch; readonly alternatives: RightPadded[]; } interface NewArray extends J, TypedTree, Expression { readonly kind: typeof Kind.NewArray; readonly typeExpression?: TypeTree; readonly dimensions: ArrayDimension[]; readonly initializer?: Container; readonly type?: Type; } interface NewClass extends J, TypedTree, MethodCall { readonly kind: typeof Kind.NewClass; readonly enclosing?: RightPadded; readonly new: Space; readonly class?: TypeTree; readonly arguments: Container; readonly body?: Block; readonly constructorType?: Type.Method; } interface NullableType extends J, TypeTree, Expression { readonly kind: typeof Kind.NullableType; readonly annotations: Annotation[]; readonly typeTree: RightPadded; } interface Package extends J { readonly kind: typeof Kind.Package; readonly expression: Expression; readonly annotations?: Annotation[]; } interface ParameterizedType extends J, TypeTree { readonly kind: typeof Kind.ParameterizedType; readonly class: NameTree; readonly typeParameters?: Container; readonly type?: Type; } interface Parentheses extends J, Expression { readonly kind: typeof Kind.Parentheses; readonly tree: RightPadded; } interface ControlParentheses extends J, Expression { readonly kind: typeof Kind.ControlParentheses; readonly tree: RightPadded; } interface Primitive extends J, TypeTree, Expression { readonly kind: typeof Kind.Primitive; type: Type.Primitive; } interface Return extends J, Statement { readonly kind: typeof Kind.Return; readonly expression?: Expression; } interface Switch extends J, Statement { readonly kind: typeof Kind.Switch; readonly selector: ControlParentheses; readonly cases: Block; } interface SwitchExpression extends J, TypedTree, Expression { readonly kind: typeof Kind.SwitchExpression; readonly selector: ControlParentheses; readonly cases: Block; readonly type?: Type; } interface Synchronized extends J, Statement { readonly kind: typeof Kind.Synchronized; readonly lock: ControlParentheses; readonly body: Block; } interface Ternary extends J, Statement, Expression, TypedTree { readonly kind: typeof Kind.Ternary; readonly condition: Expression; readonly truePart: LeftPadded; readonly falsePart: LeftPadded; readonly type?: Type; } interface Throw extends J, Statement { readonly kind: typeof Kind.Throw; readonly exception: Expression; } interface Try extends J, Statement { readonly kind: typeof Kind.Try; readonly resources?: Container; readonly body: Block; readonly catches: Try.Catch[]; readonly finally?: LeftPadded; } namespace Try { interface Resource extends J { readonly kind: typeof Kind.TryResource; readonly variableDeclarations: TypedTree; readonly terminatedWithSemicolon: boolean; } interface Catch extends J { readonly kind: typeof Kind.TryCatch; readonly parameter: ControlParentheses; readonly body: Block; } } interface TypeCast extends J, TypedTree, Expression { readonly kind: typeof Kind.TypeCast; readonly class: ControlParentheses; readonly expression: Expression; } interface TypeParameter extends J { readonly kind: typeof Kind.TypeParameter; readonly annotations: Annotation[]; readonly modifiers: Modifier[]; readonly name: Expression; readonly bounds?: Container; } interface TypeParameters extends J { readonly kind: typeof Kind.TypeParameters; readonly annotations: Annotation[]; readonly typeParameters: RightPadded[]; } interface Unary extends J, Statement, Expression, TypedTree { readonly kind: typeof Kind.Unary; readonly operator: LeftPadded; readonly expression: Expression; readonly type?: Type; } namespace Unary { const enum Type { PreIncrement = "PreIncrement", PreDecrement = "PreDecrement", PostIncrement = "PostIncrement", PostDecrement = "PostDecrement", Positive = "Positive", Negative = "Negative", Complement = "Complement", Not = "Not" } } interface VariableDeclarations extends J, TypedTree { readonly kind: typeof Kind.VariableDeclarations; readonly leadingAnnotations: Annotation[]; readonly modifiers: Modifier[]; readonly typeExpression?: TypeTree; readonly varargs?: Space; readonly variables: RightPadded[]; } namespace VariableDeclarations { interface NamedVariable extends J { readonly kind: typeof Kind.NamedVariable; readonly name: VariableDeclarator; readonly dimensionsAfterName: LeftPadded[]; readonly initializer?: LeftPadded; readonly variableType?: Type.Variable; } } interface WhileLoop extends J, Statement { readonly kind: typeof Kind.WhileLoop; readonly condition: ControlParentheses; readonly body: RightPadded; } interface Wildcard extends J, TypeTree, Expression { readonly kind: typeof Kind.Wildcard; readonly bound?: LeftPadded; readonly boundedType?: NameTree; } namespace Wildcard { const enum Bound { Extends = "Extends", Super = "Super" } } interface Yield extends J, Statement { readonly kind: typeof Kind.Yield; readonly implicit: boolean; readonly value: Expression; } interface Unknown extends J, Statement, Expression, TypeTree { readonly kind: typeof Kind.Unknown; readonly source: UnknownSource; } interface UnknownSource extends J { readonly kind: typeof Kind.UnknownSource; readonly text: string; } interface Erroneous extends J, Expression, Statement { readonly kind: typeof Kind.Erroneous; readonly text: string; } interface LeftPadded { readonly kind: typeof Kind.LeftPadded; readonly before: Space; readonly element: T; readonly markers: Markers; } interface RightPadded { readonly kind: typeof Kind.RightPadded; readonly element: T; readonly after: Space; readonly markers: Markers; } interface Container { readonly kind: typeof Kind.Container; readonly before: Space; readonly elements: RightPadded[]; readonly markers: Markers; } interface Space { readonly kind: typeof J.Kind.Space; readonly comments: Comment[]; readonly whitespace: string; } } export declare function isSpace(tree: any): tree is J.Space; /** * Builds a comment-free Space. Assigning one over an existing prefix silently drops the comments * that prefix carried; spread the prefix to keep them — `{...prefix, whitespace: "\n\n"}`. */ export declare function space(whitespace: string): J.Space; export declare const emptySpace: J.Space; export declare const singleSpace: J.Space; export declare function emptyContainer(): J.Container; export interface Comment { readonly kind: string; readonly suffix: string; readonly markers: Markers; } export interface TextComment extends Comment { readonly kind: typeof J.Kind.TextComment; readonly multiline: boolean; readonly text: string; readonly suffix: string; readonly markers: Markers; } export interface DocComment extends Comment { } export declare const isBinary: (n: any) => n is J.Binary; export declare const isBlock: (n: any) => n is J.Block; export declare const isClassDeclaration: (n: any) => n is J.ClassDeclaration; export declare const isFieldAccess: (n: any) => n is J.FieldAccess; export declare const isIdentifier: (tree: any) => tree is J.Identifier; export declare const isIf: (tree: any) => tree is J.If; export declare const isImport: (tree: any) => tree is J.Import; export declare const isLambda: (tree: any) => tree is J.Lambda; export declare const isLiteral: (tree: any) => tree is J.Literal; export declare const isMethodDeclaration: (n: any) => n is J.MethodDeclaration; export declare const isMethodInvocation: (n: any) => n is J.MethodInvocation; export declare const isNamedVariable: (n: any) => n is J.VariableDeclarations.NamedVariable; export declare const isNewClass: (n: any) => n is J.NewClass; export declare const isReturn: (n: any) => n is J.Return; export declare const isVariableDeclarations: (n: any) => n is J.VariableDeclarations; export declare function rightPadded(t: T, trailing: J.Space, markers?: Markers): J.RightPadded; export declare namespace TypedTree { function getType(typeTree?: TypedTree): Type | undefined; function registerTypeGetter(kind: T["kind"], fn: (tree: T) => Type | undefined): void; } //# sourceMappingURL=tree.d.ts.map