Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d40a21d
Gap analysis
e4c5 Feb 11, 2026
f9fc477
Old docs
e4c5 Feb 11, 2026
13b7ef8
UPdated the implementation plan
e4c5 Feb 11, 2026
f6eb12d
filling the gaps in the knowledge graph
e4c5 Feb 11, 2026
66123db
Bringing on board apache age support
e4c5 Feb 12, 2026
c6d13d6
Generalized configs for age and neo4j
e4c5 Feb 13, 2026
a197abc
Simplified the graph creation
e4c5 Feb 14, 2026
e16b771
Updated Readme
e4c5 Feb 14, 2026
216b9c4
A new annotation finder
e4c5 Feb 14, 2026
2ecc00b
Updated readme
e4c5 Feb 14, 2026
5720fdc
Better configuration management for neo4j and age
e4c5 Feb 14, 2026
cbcada4
Testing
e4c5 Feb 14, 2026
c42a6f6
Annotation finder improvement
e4c5 Feb 14, 2026
d13dca1
Bug in writing edges
e4c5 Feb 15, 2026
836d849
Support for inner classes inside method declarations
e4c5 Feb 15, 2026
2e17478
CLeaning up;
e4c5 Feb 15, 2026
a978f44
Further clean up
e4c5 Feb 15, 2026
e9b988e
Revert "Generalized configs for age and neo4j"
e4c5 Feb 16, 2026
1704d07
Benchmark findall vs visit
e4c5 Feb 16, 2026
ef4b770
Merge remote-tracking branch 'origin/euler' into euler
e4c5 Feb 16, 2026
588aabd
The bench mark
e4c5 Feb 16, 2026
9a43e4d
Minor clean up
e4c5 Feb 16, 2026
bc86b78
Added a new OpenAiService
e4c5 Feb 16, 2026
03dfc82
Cleaning up
e4c5 Feb 16, 2026
decc083
Further simplification
e4c5 Feb 16, 2026
ce2a5b0
AI loves to write more code than it has to
e4c5 Feb 16, 2026
b4f0827
Final bit of clean up
e4c5 Feb 16, 2026
5531c77
Open Ai versions updated
e4c5 Feb 16, 2026
6293dab
Merge remote-tracking branch 'origin/euler' into euler
e4c5 Feb 16, 2026
586db5b
Documentation updated
e4c5 Feb 16, 2026
6284e77
Documentation updated
e4c5 Feb 16, 2026
5943748
Fixed a bug in the open ai fetching
e4c5 Feb 16, 2026
4ea4458
Whether or not to use text blocks depends on which java version is to…
e4c5 Feb 16, 2026
4bedbe2
Method signature change comes back to haunt me
e4c5 Feb 16, 2026
a81f322
Fixed some tests
e4c5 Feb 16, 2026
c6ccfc7
New tests
e4c5 Feb 16, 2026
a9e8124
Sonar issues
e4c5 Feb 16, 2026
c2bf7fc
Test refactoring
e4c5 Feb 16, 2026
64bdeba
Merge remote-tracking branch 'origin/euler' into euler
e4c5 Feb 16, 2026
77cd9c4
Parameterized tests
e4c5 Feb 16, 2026
25654e5
New tests
e4c5 Feb 16, 2026
aeb41b5
Cost calculation bug fix
e4c5 Feb 16, 2026
24ed324
AI Service retry bug fix
e4c5 Feb 16, 2026
c983ef2
Cleaner approach
e4c5 Feb 16, 2026
1fa0173
Improvements suggested by code rabbit
e4c5 Feb 17, 2026
87a53e0
Test improvements
e4c5 Feb 17, 2026
06bdc8a
Linting issues
e4c5 Feb 17, 2026
da5ccbb
That elaborate manual json parsing was not needed
e4c5 Feb 17, 2026
c9eef8e
Argument reorder, better testing
e4c5 Feb 17, 2026
4d4b2f0
Merge remote-tracking branch 'origin/euler' into euler
e4c5 Feb 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 117 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ This module provides a suite of advanced utilities and tools built on top of the
- [Development Setup](#development-setup)
- [Maven Parent POM Converter](#maven-parent-pom-converter)
- [Query Optimizer](#query-optimizer)
- [JPA Repository Analyzer](#jpa-repository-analyzer)
- [Spring Boot Migration Tools](#spring-boot-migration-tools)
- [2.1 to 2.2 Migrator](#spring-boot-2122-migrator)
- [2.2 to 2.3 Migrator](#spring-boot-2223-migrator)
- [2.3 to 2.4 Migrator](#spring-boot-2324-migrator)
- [2.4 to 2.5 Migrator](#spring-boot-2425-migrator)
- [Spring Boot Version Detector](#spring-boot-version-detector)
- [Circular Dependency Tool](#circular-dependency-tool)
- [Code Quality & Analysis Tools](#code-quality--analysis-tools)
- [AnnotationFinder](#annotationfinder)
- [TestFixer](#testfixer)
- [Liquibase Indexes](#liquibase-indexes)
- [Logger Analysis](#logger-analysis)
- [Liquibase Tools](#liquibase-tools)
- [Liquibase Indexes](#liquibase-indexes)
- [Liquibase Validator](#liquibase-validator)
- [Liquibase Validation MCP Server](#liquibase-validation-mcp-server)
- [HardDelete Detection](#harddelete-detection)
- [UsageFinder](#usagefinder)
- [Knowledge Graph](#knowledge-graph)

---

Expand Down Expand Up @@ -114,6 +124,24 @@ Ensure your `generator.yml` is set up with valid AI service credentials and poin

---

## JPA Repository Analyzer

Bulk exports all JPA repository queries to CSV for auditing and analysis.

### Quick Start
```bash
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.antikythera.examples.JPARepositoryAnalyzer" \
-Dexec.args="-b /path/to/project -o repository_queries.csv"
```

### Features
- Extracts all `@Query` annotations from JPA repositories
- Exports query metadata to CSV format
- Supports custom output file paths
- Analyzes both explicit queries and derived query methods

---

## Spring Boot Migration Tools

Automated tools to upgrade Spring Boot applications across major/minor versions.
Expand All @@ -132,6 +160,25 @@ java -cp target/classes com.raditha.spring.SpringBoot22to23Migrator --project-pa
```
📖 **[Quick Start](docs/spring_boot_2.2_to_2.3_quickstart.md)**

### Spring Boot 2.3→2.4 Migrator
Upgrades Spring Boot 2.3 apps to 2.4.
```bash
java -cp target/classes com.raditha.spring.SpringBoot23to24Migrator --project-path /path/to/project
```

### Spring Boot 2.4→2.5 Migrator
Upgrades Spring Boot 2.4 apps to 2.5.
```bash
java -cp target/classes com.raditha.spring.SpringBoot24to25Migrator --project-path /path/to/project
```

### Spring Boot Version Detector
Detects the Spring Boot version from a POM file.
```bash
java -cp target/classes sa.com.cloudsolutions.antikythera.examples.SpringBootVersionDetector /path/to/pom.xml
```
Outputs the detected Spring Boot version to stdout.

### Circular Dependency Tool
Detects and resolves circular bean dependencies using strategies like `@Lazy`, setter injection, and **Method Extraction** for `@PostConstruct` cycles.

Expand All @@ -146,20 +193,71 @@ mvn exec:java -Dexec.mainClass="com.raditha.spring.cycle.CircularDependencyTool"

## Code Quality & Analysis Tools

### AnnotationFinder
Finds all classes and methods annotated with a specific annotation.

**Quick Start:**
```bash
# Detailed output (default) - includes full method signatures
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.antikythera.examples.AnnotationFinder" \
-Dexec.args="Service"

# Simple output - method name only, duplicates eliminated
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.antikythera.examples.AnnotationFinder" \
-Dexec.args="Service --simple"
```

**Features:**
- Searches entire codebase for specified annotation
- Handles both simple names (e.g., `Service`) and fully qualified names (e.g., `org.springframework.stereotype.Service`)
- Two output modes: detailed (default) and simple
- Supports any annotation name (e.g., `@Service`, `@Test`, `@Entity`, `@Query`)

**Output Format:**
- **Class annotations**: `com.example.MyService` (same in both modes)
- **Method annotations (detailed mode)**: `com.example.MyClass#print()` or `com.example.MyClass#print(String s)`
- **Method annotations (simple mode)**: `com.example.MyClass#print` (method name only, no duplicates for overloaded methods)

**Options:**
- `--simple` or `-s`: Enable simple output mode (method name only, eliminates duplicates)

### TestFixer
Identifies and fixes bad testing patterns (missing assertions, framework migration).
```bash
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.antikythera.examples.TestFixer" -Dexec.args="--dry-run"
```
📖 **[Documentation](docs/test_fixer.md)**

### Liquibase Indexes
Audits database indexes defined in Liquibase changelogs.
### Logger Analysis
Analyzes and standardizes logger usage across the codebase, ensuring consistent logging patterns.
```bash
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.antikythera.examples.Logger"
```
Processes all classes in the project and standardizes logger field declarations and usage.

### Liquibase Tools

#Audits database indexes defined in Liquibase changelogs.
```bash
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.liquibase.Indexes" -Dexec.args="path/to/db.changelog-master.xml"
```
📖 **[Documentation](docs/liquibase_indexes.md)**

#### Liquibase Validator
Validates Liquibase changelog XML files for syntax errors and structural issues.
```bash
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.antikythera.mcp.LiquibaseValidator" \
-Dexec.args="path/to/changelog.xml"
```
Outputs validation results in JSON format with exit code 0 for valid files, 1 for invalid.

#### Liquibase Validation MCP Server
MCP (Model Context Protocol) server for Liquibase validation, enabling integration with AI agents and tools.
```bash
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.antikythera.mcp.LiquibaseValidationMcpServer"
```
Starts an MCP server that provides Liquibase validation capabilities via the MCP protocol.

### HardDelete Detection
Finds hard delete operations in repositories to enforce soft-delete policies.
```bash
Expand All @@ -173,3 +271,19 @@ Analyzes collection usage (List, Set, Map) in non-entity classes to detect poten
mvn exec:java -Dexec.mainClass="sa.com.cloudsolutions.antikythera.examples.UsageFinder"
```
📖 **[Documentation](docs/usage_finder.md)**

---

## Knowledge Graph

### KnowledgeGraphCLI
Generates knowledge graphs from Java codebases, visualizing relationships between classes, methods, and dependencies.
```bash
mvn exec:java -Dexec.mainClass="com.raditha.graph.KnowledgeGraphCLI" \
-Dexec.args="--base-path=/path/to/project --config=src/main/resources/graph.yml"
```

### Features
- Builds comprehensive dependency graphs
- Configurable analysis scope via YAML configuration
- Visualizes code relationships and dependencies
70 changes: 70 additions & 0 deletions docs/findAll-vs-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Java Parser Method Finding Benchmark

## Overview

This benchmark compares the performance of two approaches for finding a specific method declaration in a JavaParser AST:

1. **Using `findAll()`**: Calling `TypeDeclaration.findAll(MethodDeclaration.class)` and filtering by name
2. **Using `VoidVisitor`**: Using a custom `VoidVisitorAdapter` to traverse the AST

## Benchmark Details

- **Target File**: `AbstractCompiler.java` (~1591 lines)
- **Target Method**: `camelToSnakeCase`
- **Iterations**: 1000 per approach
- **JVM Warmup**: 100 iterations before actual benchmark

## Results

Based on multiple benchmark runs, the results consistently show:

| Approach | Average Time (1000 iterations) | Performance |
|----------|-------------------------------|-------------|
| `findAll()` | ~87-90 ms | **2.3-2.6x FASTER** |
| `VoidVisitor` | ~205-225 ms | Baseline |

## Key Findings

1. **`findAll()` is significantly faster** (~2.4x on average) than using a VoidVisitor pattern
2. Both methods successfully locate the same method declaration (verification passed)
3. Results are consistent across multiple runs with minimal variance

## Why is `findAll()` Faster?

The `findAll()` method in JavaParser is highly optimized and uses internal shortcuts to efficiently traverse the AST. The VoidVisitor pattern, while more flexible, involves:
- Additional object creation (visitor instance)
- Virtual method dispatch overhead
- More callback invocations during traversal

## When to Use Each Approach

### Use `findAll()` when:
- You need to find all instances of a specific node type
- Performance is critical
- The search criteria is simple (type-based filtering)

### Use `VoidVisitor` when:
- You need complex custom logic during traversal
- You need to maintain state across multiple node visits
- You need to visit multiple different node types in a single pass
- You need to modify the AST during traversal

## Running the Benchmark

```bash
cd /home/raditha/csi/Antikythera/antikythera-examples
mvn clean compile test-compile
java -cp "target/test-classes:target/classes:$(mvn dependency:build-classpath -q -Dmdep.outputFile=/dev/stdout)" com.raditha.perf.JavaParserMethodFindingBenchmark
```

## Implementation Notes

- JavaParser is configured to support Java 21 language features
- The benchmark includes JVM warmup to ensure accurate measurements
- Both methods operate on the same parsed `CompilationUnit` to ensure fair comparison
- Timing is done using `System.nanoTime()` for high precision

## Conclusion

For simple method lookups by name, **`findAll()` is the clear winner** in terms of performance. However, the VoidVisitor pattern remains valuable for more complex traversal scenarios where its flexibility outweighs the performance overhead.

Loading