# Getting Started

## What This Project Does

This repository is a **Java codebase test harness** — it contains curated example classes used to validate documentation generators, source-code analyzers, and static-analysis tools. Each sub-module exercises a specific dimension of code understanding: field description styles, test-code detection, file-header parsing, and edge cases like multibyte encoding or massive field maps.

## Recommended Reading Order

1. **[Project Structure](#project-structure)** — understand the four sub-modules and what each one tests
2. **[Key Entry Points](#key-entry-points)** — read the representative classes in each module
3. **[Common Patterns](#common-patterns)** — learn the conventions used throughout (naming, headers, annotation styles)
4. **[Configuration](#configuration)** — review the coding standards and file-layout rules

## Key Entry Points

Read these classes first to understand the patterns each sub-module exercises:

| Module | Class | Path | What it teaches |
|--------|-------|------|-----------------|
| `p2-edge-cases` | `OrderProcessor` | `p2-edge-cases/src/main/java/OrderProcessor.java` | Well-commented JavaDoc class — the ideal reference format |
| `p2-edge-cases` | `ProductService` | `p2-edge-cases/src/main/java/ProductService.java` | Minimal class with no comments — an edge case |
| `p2-edge-cases` | `LargeFieldMap` | `p2-edge-cases/src/main/java/LargeFieldMap.java` | Entity with many fields and mixed Japanese/English labels |
| `story1-field-description` | `PatternA` | `story1-field-description/src/main/java/PatternA.java` | Fields annotated with `ANK-0001` ADD START/END markers |
| `story1-field-description` | `Mixed` | `story1-field-description/src/main/java/Mixed.java` | Mix of labeled and unlabeled fields in one class |
| `story2-test-code` | `OrderService` | `story2-test-code/src/main/java/com/example/OrderService.java` | Plain production code under `com.example` |
| `story2-test-code` | `OrderServiceTest` | `story2-test-code/src/test/java/com/example/OrderServiceTest.java` | JUnit `@Test`-annotated test class |
| `story2-test-code` | `TestNGTest` | `story2-test-code/src/main/java/com/example/TestNGTest.java` | TestNG `@Test`-annotated class (in main source) |
| `story2-test-code` | `LegacyTest` | `story2-test-code/src/main/java/com/example/LegacyTest.java` | JUnit 3 `TestCase` subclass — legacy pattern |
| `story4-file-headers` | `WithHeader` | `story4-file-headers/src/main/java/WithHeader.java` | Standard `ANK-xxxx` header block |
| `story4-file-headers` | `MitLicense` | `story4-file-headers/src/main/java/MitLicense.java` | Open-source MIT license header |
| `story4-file-headers` | `NoHeader` | `story4-file-headers/src/main/java/NoHeader.java` | Missing header — edge case for scanners |

## Project Structure

```
.
├── p2-edge-cases/                 # Edge-case classes for analyzer validation
│   └── src/main/java/
│       ├── A.java                 # Minimal empty class
│       ├── EucJpClass.java        # Class with multibyte (EUC-JP) field labels
│       ├── LargeBusinessLabelClass.java  # Class with 50 labeled fields
│       ├── LargeFieldMap.java     # Entity with many fields, mixed labels
│       ├── MixedLabelClass.java   # Mixed labeled / unlabeled / English-only
│       ├── MultiPattern.java      # ANK-style ADD markers alongside regular fields
│       ├── OrderProcessor.java    # Fully documented class (reference format)
│       ├── PartialLabelEntity.java # Partial labeling pattern
│       └── ProductService.java    # Bare class, no comments
├── story1-field-description/      # Field description style test cases
│   └── src/main/java/
│       ├── Mixed.java             # English + unlabeled fields
│       ├── PatternA.java          # ANK-0001 ADD START/END markers
│       └── PatternB.java          # Japanese service-IF labels
├── story2-test-code/              # Test-code detection patterns
│   ├── src/
│   │   ├── main/java/com/example/   # Test-like classes in main source
│   │   │   ├── LegacyTest.java      # JUnit 3 TestCase
│   │   │   ├── OrderService.java    # Plain production class
│   │   │   ├── RogueTestAnnotated.java # @Test in main source
│   │   │   ├── TestHelper.java      # Test utility class
│   │   │   └── TestNGTest.java      # TestNG @Test class
│   │   └── test/java/com/example/   # Standard test directory
│   │       ├── OrderServiceTest.java # JUnit 4/5 @Test method
│   │       └── UnannotatedInTest.java # Class in test dir, no @Test
│   ├── standalone/
│   │   └── OrderServiceTest.java    # Standalone test file (outside src/)
│   └── src/utils/
│       └── ImportOnlyTest.java      # Test class imported but never used
└── story4-file-headers/           # File-header style test cases
    └── src/main/java/
        ├── Crosslink.java           # Header with cross-references
        ├── LongHeader.java          # Header with 50+ revision entries
        ├── MitLicense.java          # MIT license header
        ├── NoHeader.java            # No header at all
        ├── NoModuleNoPurpose.java   # Header with program name, no module
        ├── PartialHeader.java       # Incomplete header block
        └── WithHeader.java          # Standard complete header
```

## Configuration

This project is organized as a set of independent Maven-style modules. Each module has its own `src/main/java` tree. There are no global build files at the root — each sub-module is self-contained.

Key structural conventions:

- **`src/main/java`** — Production (or production-like) Java sources
- **`src/test/java`** — Standard test sources, following Maven conventions
- **`src/utils`** — Utility classes that may be imported but are not directly tested
- **`standalone/`** — Test files placed outside the standard Maven layout (edge case)

## Common Patterns

### Naming Conventions

- Classes use **PascalCase**: `OrderProcessor`, `LargeFieldMap`, `OrderServiceTest`
- Fields use **camelCase**: `orderId`, `syoriDiv`, `templateID`
- Package names follow **reverse domain** style: `com.example`

### Annotation Styles

The test harness exercises several Java testing frameworks:

```java
// JUnit 4 / 5 — method-level @Test
@Test
void test() {}
```

```java
// TestNG — same @Test annotation, different package
import org.testng.annotations.Test;
@Test
void run() {}
```

```java
// JUnit 3 — legacy inheritance pattern
import junit.framework.TestCase;
public class LegacyTest extends TestCase { }
```

### File Header Conventions

Java files in this repo follow several header styles — the analyzer should handle all of them:

```java
/**
 * ANK-style project header
 * <プログラム内容>
 *   モジュール名    : ModuleName
 * <機能概要>
 *   Feature description
 * <修正履歴>
 *   v01.00.00  2024/01/01  Author  【ANK-0001-00-00】Initial
 */
```

```java
/**
 * MIT License
 * Copyright (c) 2024
 */
```

Some files intentionally have **no header** (`NoHeader.java`) or **partial headers** (`PartialHeader.java`) to test scanner resilience.

### Field Label Patterns

Field comments use several conventions:

- **Japanese labels** — `// ユーザーID`
- **English labels** — `// Service IF_ID`
- **No labels** — field declared without any trailing comment
- **ANK markers** — `// ANK-0001 ADD START` / `// ANK-0001 ADD END` for diff-tracking

### Encoding

The `EucJpClass.java` file exercises EUC-JP encoded Japanese characters. Ensure your editor and tools support multibyte encodings when reading this repository.
