Releases: Codegass/Javalang-analyzing-cli
Releases Β· Codegass/Javalang-analyzing-cli
v1.3.3
[1.3.3] - 2025-06-02
π Critical Bug Fix - JUnit Framework Support Enhancement
- Fixed junit.framework.TestCase Assert Recognition: Major fix for assertion detection in legacy JUnit projects
- Problem:
junit.framework.TestCase
assert methods were showing asUNRESOLVED_INVOCATION
instead ofASSERT
- Root Cause:
isAssert()
method only checked fororg.junit
but notjunit.framework
package - Solution: Added explicit support for
junit.framework
package in assertion detection - Impact: Eliminates false unresolved invocations in projects using JUnit 3.x style assertions
- Problem:
β¨ New Feature - JUnit 3.x Test Method Detection
- Legacy Test Method Support: Added support for JUnit 3.x style test method detection
- Pattern Recognition: Detects
public void testXxx()
methods without requiring@Test
annotations - Validation: Ensures methods are public, void, parameterless, and follow
testXxx
naming convention - Backward Compatibility: Maintains full support for modern
@Test
annotated methods
- Pattern Recognition: Detects
π§ Technical Improvements
- Enhanced
isAssert()
Method: Addedjunit.framework
package detection for comprehensive assertion recognition - Extended
isTestMethod()
Method: Added JUnit 3.x test method pattern detection alongside annotation-based detection - Smart Test Detection: Combines modern annotation-based and legacy naming convention-based test detection
π§ͺ Verification - commons-vfs Project
Before (v1.3.2):
"unresolvedInvocations": [
"UNRESOLVED_INVOCATION: assertSame(opts,newOpts)#[61-61]",
"UNRESOLVED_INVOCATION: assertTrue(builder.isVersioning(newOpts))#[62-62]",
"UNRESOLVED_INVOCATION: assertFalse(file.exists())#[63-63]"
]
After (v1.3.3):
"parsedStatementsSequence": [
"ASSERT junit.framework.Assert.assertSame(Object, Object)#[61-61]",
"ASSERT junit.framework.Assert.assertTrue(boolean)#[62-62]",
"ASSERT junit.framework.Assert.assertFalse(boolean)#[63-63]"
]
π Impact Analysis
- Legacy Projects: Significantly reduces false unresolved invocations in JUnit 3.x projects
- commons-vfs: From 1279 unresolved invocations to much fewer (mainly legitimate resolution issues)
- Test Coverage: Now supports full spectrum of JUnit versions (3.x, 4.x, 5.x)
- Analysis Accuracy: Dramatically improved assertion recognition across different JUnit frameworks
This fix is particularly important for analyzing older Java projects that still use JUnit 3.x conventions.
v1.3.2
[1.3.2] - 2025-06-02
π Critical Bug Fix - Inner Class Source Resolution
- Fixed SOURCE_FILE_NOT_FOUND for Inner Classes: Major fix for source file detection of inner classes
- Problem: Classes like
org.apache.commons.cli.HelpFormatter.Builder
were causing SOURCE_FILE_NOT_FOUND errors - Root Cause: Method was searching for
org/apache/commons/cli/HelpFormatter/Builder.java
instead oforg/apache/commons/cli/HelpFormatter.java
- Solution: Enhanced
getSourceFilePathForClass()
to detect inner classes and map them to their outer class source files - Impact: Dramatically reduces SOURCE_FILE_NOT_FOUND errors in projects with inner classes
- Problem: Classes like
π§ Technical Improvements
- Smart Inner Class Detection: Added logic to identify inner classes by uppercase naming patterns
- Outer Class Mapping: Automatically strips inner class portions to find the correct source file
- Enhanced Debug Logging: Added detailed logging for source file resolution process
π§ͺ Verification
- commons-cli Project: Tested on Apache Commons CLI project - eliminated most SOURCE_FILE_NOT_FOUND errors
- Before: Multiple SOURCE_FILE_NOT_FOUND errors for
HelpFormatter.Builder
methods - After: All inner class methods now correctly resolve to their source files
This fix significantly improves analysis accuracy for projects using inner classes, which are common in Java projects.
v1.3.1
[1.3.1] - 2025-06-02
π Bug Fixes - Windows Path Compatibility
- Log File Path Handling: Fixed Windows path compatibility issues in logging system
- Relative Path Recording: Changed from absolute to relative paths in unresolved case logs
- Cross-platform File Names: Enhanced filename sanitization to handle Windows path separators
- Log File Creation: Added project name sanitization for safe log file creation
π§ Technical Improvements
- Enhanced Filename Sanitization: Updated regex pattern from
[^a-zA-Z0-9.-]
to[^a-zA-Z0-9._-]
- Relative Path Storage: Log entries now store
src/test/java/com/example/Test.java
instead of full paths - Project Name Cleaning: Automatic removal of invalid characters from project names in log filenames
π Cross-Platform Benefits
- β
Windows: Log files now correctly handle
C:\Users\...
style paths - β Unix/Linux/macOS: Maintains full backward compatibility
- β JSON Compatibility: Eliminates escaping issues with backslashes in JSON output
π Log File Improvements
{
"unresolvedCases": [
{
"fileName": "src/test/java/com/example/Test.java", // β
Relative path
"className": "com.example.Test",
"methodName": "testMethod"
}
]
}
Before (v1.3.0): "fileName": "C:\\Users\\user\\project\\src\\test\\java\\Test.java"
β
After (v1.3.1): "fileName": "src/test/java/Test.java"
β
[1.3.0] - 2025-06-02
π Major Features
- Runtime Logging System: Added comprehensive analysis session logging
- Execution Time Tracking: Automatic recording of start time, end time, and duration
- Test Case Statistics: Total and processed test case counts
- Unresolved Invocation Detection: Automatic detection and detailed tracking of unresolved method calls
- Structured Log Output: JSON format log files saved to
<output_dir>/<project_name>-log.json
β¨ New Features
- LogData Class: Dedicated data structure for logging analysis session information
- Smart Status Tracking: RUNNING β COMPLETED/FAILED/INTERRUPTED status progression
- Unresolved Code Analysis: Identifies and catalogues:
UNRESOLVED_INVOCATION
- Method calls that couldn't be resolvedUNRESOLVED_CONSTRUCTOR
- Constructor calls that couldn't be resolvedUNRESOLVED_METHOD_REF
- Method references that couldn't be resolvedMETHOD_NOT_FOUND_IN_SOURCE
- Methods not found in source codeSOURCE_FILE_NOT_FOUND
- Source files that couldn't be located
- Graceful Interruption Handling: Shutdown hooks to save logs even when interrupted
- Project Context Integration: LogData integrated into ProjectCtx for task access
π§ Technical Improvements
- Exception Handling: Robust error handling with detailed error message logging
- Cross-platform Compatibility: All logging functionality works on Windows/Linux/macOS
- Memory Efficient: Streaming JSON output without memory overhead
- Thread Safe: Volatile flags for proper multi-threading support
π Log File Structure
{
"projectName": "example-project",
"taskName": "ParseTestCaseToLlmContext",
"startTime": "2025-06-02T01:42:33",
"endTime": "2025-06-02T01:42:34",
"durationMs": 1243,
"totalTestCases": 3,
"processedTestCases": 3,
"unresolvedInvocationCount": 2,
"unresolvedCases": [
{
"className": "com.example.SampleTest",
"methodName": "testWithUnresolvedCode",
"fileName": "/path/to/SampleTest.java",
"startLine": 14,
"endLine": 22,
"unresolvedCount": 2,
"unresolvedInvocations": [
"UNRESOLVED_CONSTRUCTOR: new SomeUnknownClass()#[17-17]",
"UNRESOLVED_INVOCATION: unknown.someMethod()#[18-18]"
]
}
],
"status": "COMPLETED"
}
π― Use Cases
- Performance Monitoring: Track analysis execution time across different projects
- Quality Assessment: Identify test cases with resolution issues
- Problem Debugging: Pinpoint exact locations of unresolved method calls
- Project Analytics: Generate reports on test coverage and code quality
V1.1.2
[1.1.2] - 2024-05-30
π Bug Fixes
- Windows Path Compatibility: Fixed cross-platform path handling issues
- Test Directory Detection: Enhanced
isTestDirectory()
to normalize Windows backslashes to forward slashes - Production/Test Code Classification: Fixed
isProductionCode()
andisTestCode()
methods to handle Windows paths - Source File Path Resolution: Updated
getSourceFilePathForClass()
to usePath.resolve()
instead of hardcoded path strings - Root Cause: Previous implementation only handled Unix-style paths (
/
), causing "No test source roots found" on Windows - Solution: Added path normalization (
pathString.replace('\\', '/')
) throughout path comparison logic
- Test Directory Detection: Enhanced
π§ Technical Details
- Modified
ParseTestCaseToLlmContextTask.isTestDirectory()
method - Enhanced
TestCaseAnalyzer.isProductionCode()
andisTestCode()
methods - Updated
TestCaseAnalyzer.getSourceFilePathForClass()
to use properPath.resolve()
chains - All path comparisons now use normalized forward slash format internally
- Maintains full backward compatibility on Unix/Linux/macOS systems
π Cross-Platform Support
- β
Windows: Now correctly identifies test directories like
D:\project\src\test\java
- β
Unix/Linux: Continues to work with
/project/src/test/java
- β
macOS: Continues to work with
/project/src/test/java
v1.1.1
[1.1.1] - 2024-05-30
π Bug Fixes
- Duplicate JSON File Extension: Fixed issue where output files had double
.json.json
extension- Problem:
getJsonFileName()
was returning filename with.json
extension, then.json
was added again during file creation - Solution: Modified
getJsonFileName()
to return base filename without extension - Files now correctly named as
project_class_method.json
instead ofproject_class_method.json.json
- Problem:
π§ Technical Details
- Modified
TestCaseAnalyzer.AnalysisResult.getJsonFileName()
method - Maintains backward compatibility - no changes to JSON content format
- File sanitization (replacing invalid characters with
_
) still works correctly
V1.1.0
Javalang-analyzing-cli v1.1.0
π¦ Release Files
- Javalang-analyzing-cli-1.1.0-all.jar (19M) - Main executable Fat JAR
- README.md - Complete usage documentation
- CHANGELOG.md - Version change log
- LICENSE - Open source license
- analyzer.yml - Example configuration file
- run.sh / run.bat - Quick start scripts
π Quick Start
System Requirements
- Java 21 or higher
Basic Usage
# Check version
java -jar Javalang-analyzing-cli-1.1.0-all.jar --version
# Analyze project
java -jar Javalang-analyzing-cli-1.1.0-all.jar ParseTestCaseToLlmContext \
--project /path/to/your/java/project
# Use configuration file
java -jar Javalang-analyzing-cli-1.1.0-all.jar ParseTestCaseToLlmContext \
--config analyzer.yml
Using Scripts
# Linux/macOS
./run.sh ParseTestCaseToLlmContext --project /path/to/project
# Windows
run.bat ParseTestCaseToLlmContext --project C:\path\to\project
π New Features
See CHANGELOG.md for complete feature list and updates.
π Issue Reporting
For issues, please report them in GitHub Issues.
v1.0.0
Changelog
All notable changes to this project will be documented in this file.
[1.0.0] - 2024-05-30
π Initial Release
β¨ New Features
- ParseTestCaseToLlmContext Task: Parses Java test cases and generates LLM-friendly JSON output
- Intelligent Build System Detection: Automatically identifies and configures Maven/Gradle projects
- Enhanced Dependency Resolution:
- Maven: Parses dependencies from
pom.xml
, automatically handles property variables - Gradle: Uses Tooling API to get project configuration
- Automatic search of local caches (
~/.m2
,~/.gradle/caches
) for missing dependencies
- Maven: Parses dependencies from
- Automatic Test Framework Support: JUnit 4/5, Mockito, Hamcrest, AssertJ
- Intelligent Statement Classification: ASSERT, MOCK, NEW, THIRD, GET/SET, PRODUCTION
- DFS Method Call Analysis: Recursively expands method calls within test cases
- Multi-threaded Parallel Processing: Supports concurrent analysis of multiple test files
- Extensible Plugin Architecture: Task and visitor extension mechanism based on Java SPI
π§ Technical Features
- Fat JAR Distribution: Includes all dependencies, ready to use out of the box
- Detailed Debug Logging: Complete dependency resolution and configuration detection logs
- Cross-platform Support: Windows, macOS, Linux
- Java 21 Support: Uses latest JDK features
π Output Format
{
"project": "project name",
"testClassName": "fully qualified test class name",
"testCaseName": "test method name",
"parsedStatementsSequence": ["method call sequence"],
"productionFunctionImplementations": ["production code implementations"],
"testCaseSourceCode": "test case source code",
"importedPackages": ["imported packages list"]
}
ποΈ Dependencies
- parser-core: Core AST parsing engine
- picocli: Command line interface framework
- Eclipse JDT: Java development tools core
- Gson: JSON serialization library
π Command Line Interface
java -jar Javalang-analyzing-cli-1.0.0-all.jar ParseTestCaseToLlmContext \
--project /path/to/project \
--format json
π Known Issues
- Output directory is currently hardcoded to
results/
folder under project root - Some complex Maven dependency management scenarios may require manual intervention
π Future Plans
- Support for Go and Python project analysis
- Configurable output directory
- More built-in analysis tasks
- Web UI interface
Version Format Description
- [Major.Minor.Patch] - Release date
- Major: Incompatible API changes
- Minor: Backward-compatible functionality additions
- Patch: Backward-compatible bug fixes