import type { SymbolInfo, SyntaxNode } from '../types.js'; import type { LanguageDefinition } from './types.js'; import type { LanguageTraverser, DeclarationFunctionInfo } from '../traversers/types.js'; import type { LanguageExportExtractor, LanguageImportExtractor, LanguageSymbolExtractor } from '../extractors/types.js'; /** * Java AST traverser * * Java has a class-based container structure — methods live inside class, * interface, enum, and record declarations. Unlike Go's flat structure, * Java requires container traversal to find methods. * * Lambda expressions can appear in variable declarations: * Runnable r = () -> { ... }; */ export declare class JavaTraverser implements LanguageTraverser { targetNodeTypes: string[]; containerTypes: string[]; declarationTypes: string[]; functionTypes: string[]; shouldExtractChildren(node: SyntaxNode): boolean; isDeclarationWithFunction(node: SyntaxNode): boolean; getContainerBody(node: SyntaxNode): SyntaxNode | null; shouldTraverseChildren(node: SyntaxNode): boolean; findParentContainerName(node: SyntaxNode): string | undefined; findFunctionInDeclaration(node: SyntaxNode): DeclarationFunctionInfo; } /** * Java export extractor * * Java uses the `public` modifier for visibility — public declarations are * accessible outside the package (similar to Rust's `pub`). * * Exportable items: * - public class User {} * - public interface Repository {} * - public enum Status {} * - public record Point(int x, int y) {} * - public void method() {} (inside a class) * - Interface methods are implicitly public * * Package-private (default access) declarations are NOT exported. */ export declare class JavaExportExtractor implements LanguageExportExtractor { extractExports(rootNode: SyntaxNode): string[]; private extractFromNode; private extractPublicMembers; private extractMemberExport; private extractFieldNames; } /** * Java import extractor * * Handles all Java import patterns: * - import com.example.MyClass; (single import) * - import com.example.*; (wildcard import) * - import static com.example.Utils.method; (static import) * - import static com.example.Utils.*; (static wildcard import) * * Standard library imports (java.*, javax.*) are filtered out. */ export declare class JavaImportExtractor implements LanguageImportExtractor { readonly importNodeTypes: string[]; extractImportPath(node: SyntaxNode): string | null; extractImportPaths(node: SyntaxNode): string[]; processImportSymbols(node: SyntaxNode): { importPath: string; symbols: string[]; } | null; processImportSymbolsList(node: SyntaxNode): Array<{ importPath: string; symbols: string[]; }>; private getImportPath; } /** * Java symbol extractor * * Handles: * - method_declaration (public void method() {}) * - constructor_declaration (public MyClass() {}) * - class_declaration (class MyClass {}) * - interface_declaration (interface MyInterface {}) * - enum_declaration (enum MyEnum {}) * - record_declaration (record MyRecord(int x) {}) * * `parentClass` is threaded into every type-declaration handler (not just * methods/constructors) so a nested type (`class Retrofit { public static * final class Builder { ... } }`) reports its enclosing type — the chunker * (`ast/chunker.ts`'s `processTopLevelNode`) already resolves this via * `JavaTraverser.findParentContainerName` for every top-level node regardless * of kind; previously only the method/constructor handlers accepted the * parameter, so a nested class/interface/enum/record silently lost it (#949 — * this is the confirmed repro: `Retrofit.Builder`, `RequestFactory.Builder`, * etc. all reported `parentClass: null`, making six same-named `Builder` * results indistinguishable except by file path). * * Call sites: method_invocation (direct calls and object.method() calls) */ export declare class JavaSymbolExtractor implements LanguageSymbolExtractor { readonly symbolNodeTypes: string[]; extractSymbol(node: SyntaxNode, content: string, parentClass?: string): SymbolInfo | null; extractCallSite(node: SyntaxNode): { symbol: string; line: number; key: string; } | null; private extractMethodInfo; private extractConstructorInfo; private extractClassInfo; private extractInterfaceInfo; private extractEnumInfo; private extractRecordInfo; /** * #1005 Phase 3 Item B: `@interface Foo {}` maps to `symbolType: 'interface'` * -- mirrors the existing `record_declaration` -> `'class'` precedent * directly above rather than introducing a new `'annotation'` member to * `ChunkMetadata['symbolType']`'s closed union (rejected: ~14 hand-maintained * duplicate-union-site updates with no compiler safety net, for a purely * cosmetic distinction -- `'interface'` already works everywhere). An * annotation declaration has no type parameters and no * extends/implements heritage, so unlike the other type-declaration * handlers this doesn't call `typeParamsAndHeritage` at all. */ private extractAnnotationInfo; } export declare const javaDefinition: LanguageDefinition; //# sourceMappingURL=java.d.ts.map