javaast

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package javaast provides shared Java AST traversal utilities for test framework parsers.

Index

Constants

View Source
const (
	NodeClassDeclaration       = "class_declaration"
	NodeMethodDeclaration      = "method_declaration"
	NodeAnnotation             = "annotation"
	NodeMarkerAnnotation       = "marker_annotation"
	NodeModifiers              = "modifiers"
	NodeIdentifier             = "identifier"
	NodeFormalParameters       = "formal_parameters"
	NodeClassBody              = "class_body"
	NodeAnnotationArgumentList = "annotation_argument_list"
)

Java AST node types.

Variables

This section is empty.

Functions

func GetAnnotationArgument

func GetAnnotationArgument(annotation *sitter.Node, source []byte) string

GetAnnotationArgument extracts the annotation argument value. For @DisplayName("My Test"), returns "My Test".

func GetAnnotationName

func GetAnnotationName(annotation *sitter.Node, source []byte) string

GetAnnotationName extracts the simple annotation name (e.g., "Test" from @Test or @org.junit.jupiter.api.Test). For scoped identifiers, returns only the simple name (last segment).

func GetAnnotations

func GetAnnotations(modifiers *sitter.Node) []*sitter.Node

GetAnnotations extracts all annotation nodes from a modifiers node.

func GetClassBody

func GetClassBody(node *sitter.Node) *sitter.Node

GetClassBody returns the class body node from a class_declaration.

func GetClassName

func GetClassName(node *sitter.Node, source []byte) string

GetClassName extracts the class name from a class_declaration node.

func GetMethodName

func GetMethodName(node *sitter.Node, source []byte) string

GetMethodName extracts the method name from a method_declaration node.

func GetModifiers

func GetModifiers(node *sitter.Node) *sitter.Node

GetModifiers returns the modifiers node from a method or class declaration.

func HasAnnotation

func HasAnnotation(modifiers *sitter.Node, source []byte, annotationName string) bool

HasAnnotation checks if the modifiers contain a specific annotation.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL