Skip to content

dschiese/source-code-retrieval-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Source Code Retrieval Processor

A Java annotation processor that collects method-level metadata during compilation and generates a registry class for runtime access.

What it does

  • scans compiled source units in annotation-processing rounds
  • inspects discovered classes and methods
  • extracts a lightweight method signature/source line hint
  • generates MethodRegistry with MethodInfo entries

The generated registry can be used by downstream tooling for search, retrieval, traceability, or explanation workflows.

Current status

This repository is a working prototype.

  • implemented: core annotation processor and generated registry output
  • implemented: service registration for javax.annotation.processing.Processor
  • pending: robust method-source extraction (currently naive string matching)
  • pending: richer model conversion (JsonConverter, helper models)

Project structure

  • src/main/java/org/wseresearch/source_code_retrieval/SourceCodeProcessor.java - annotation processor
  • src/main/java/org/wseresearch/source_code_retrieval/MethodInfo.java - metadata model
  • src/main/resources/META-INF/services/javax.annotation.processing.Processor - processor registration
  • src/test/java/.../SourceCodeRetrievalApplicationTests.java - baseline test scaffold

Build

./mvnw clean test

Usage in another Maven project

Add dependency:

<dependency>
  <groupId>org.wseresearch</groupId>
  <artifactId>source-code-retrieval</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>

Configure the compiler plugin:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.14.0</version>
  <configuration>
    <annotationProcessorPaths>
      <path>
        <groupId>org.wseresearch</groupId>
        <artifactId>source-code-retrieval</artifactId>
        <version>${project.version}</version>
      </path>
    </annotationProcessorPaths>
  </configuration>
</plugin>

After compilation, inspect generated sources under your Maven generated-sources directory for MethodRegistry.

Notes

  • Java compatibility in pom.xml currently mixes Spring Boot 3.x and explicit compiler source/target values; align this before publishing.
  • For production-grade extraction, replace naive line matching with parser-based extraction (e.g., JavaParser).

About

Java annotation processor that captures method metadata at compile time.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages